Skip to content

Commit

Permalink
[MIG] purchase_lot: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alan196 committed Sep 5, 2024
1 parent 39a6229 commit 840152f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion purchase_lot/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Purchase Lot",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Purchase",
"license": "AGPL-3",
"author": "Akretion, Odoo Community Association (OCA)",
Expand Down
6 changes: 2 additions & 4 deletions purchase_lot/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

lot_id = fields.Many2one(
"stock.lot", string="Serial Number", readonly=True, copy=False
)
lot_id = fields.Many2one("stock.lot", string="Serial Number", copy=False)

@api.model
def _prepare_purchase_order_line_from_procurement(
Expand Down Expand Up @@ -46,7 +44,7 @@ def _find_candidate(
values,
):
lot_id = values.get("restrict_lot_id", False)
self = self.filtered(lambda l: l.lot_id.id == lot_id)
self = self.filtered(lambda line: line.lot_id.id == lot_id)
return super()._find_candidate(
product_id,
product_qty,
Expand Down
4 changes: 3 additions & 1 deletion purchase_lot/tests/test_purchase_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def test_purchase_lot(self):
)
# not merged because of different lot
self.assertEqual(len(pols), 2)
pol1 = pols.filtered(lambda l: l.move_dest_ids.restrict_lot_id.id == lot1.id)
pol1 = pols.filtered(
lambda line: line.move_dest_ids.restrict_lot_id.id == lot1.id
)
self.assertEqual(pol1.lot_id.id, lot1.id)
pol1.order_id.button_confirm()
self.assertEqual(pol1.move_ids.restrict_lot_id.id, lot1.id)
4 changes: 2 additions & 2 deletions purchase_lot/views/purchase_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
expr="//field[@name='order_line']/tree/field[@name='name']"
position="after"
>
<field name="lot_id" />
<field name="lot_id" readonly="1" />
</xpath>
</field>
</record>
Expand All @@ -19,7 +19,7 @@
<field name="inherit_id" ref="purchase.purchase_order_line_form2" />
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name="lot_id" />
<field name="lot_id" readonly="1" />
</xpath>
</field>
</record>
Expand Down

0 comments on commit 840152f

Please sign in to comment.