Skip to content

Commit

Permalink
[FIX] sale_procurement_group_by_line: update to odoo
Browse files Browse the repository at this point in the history
  • Loading branch information
MiquelRForgeFlow committed Nov 25, 2024
1 parent 040ed51 commit bac440f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
17 changes: 6 additions & 11 deletions sale_procurement_group_by_line/model/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def _action_launch_stock_rule(self, previous_product_uom_qty=False):
previous_product_uom_qty = {}
for line in self:
line = line.with_company(line.company_id)
if line.state != "sale" or line.product_id.type not in ("consu", "product"):
if (
line.state != "sale"
or line.order_id.locked
or line.product_id.type not in ("consu", "product")
):
continue
qty = line._get_qty_procurement(previous_product_uom_qty)
if (
Expand Down Expand Up @@ -88,16 +92,7 @@ def _action_launch_stock_rule(self, previous_product_uom_qty=False):
)

procurements.append(
self.env["procurement.group"].Procurement(
line.product_id,
product_qty,
procurement_uom,
line.order_id.partner_shipping_id.property_stock_customer,
line.display_name,
line.order_id.name,
line.order_id.company_id,
values,
)
line._create_procurement(product_qty, procurement_uom, values)
)
# We store the procured quantity in the UoM of the line to avoid
# duplicated procurements, specially for dropshipping and kits.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def test_02_action_launch_procurement_rule_1(self):
self.sale.action_confirm()
self.assertEqual(self.sale.state, "sale")
self.assertEqual(len(self.line1.move_ids), 1)
self.assertEqual(self.line1.move_ids.name, self.line1.display_name)
self.assertEqual(self.line1.move_ids.name, self.line1.product_id.display_name)
self.assertEqual(len(self.line2.move_ids), 1)
self.assertEqual(self.line2.move_ids.name, self.line2.display_name)
self.assertEqual(self.line2.move_ids.name, self.line2.product_id.display_name)

def test_03_action_launch_procurement_rule_2(self):
group_id = self.proc_group_model.create(
Expand Down

0 comments on commit bac440f

Please sign in to comment.