Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][FIX] sale_procurement_group_by_line: update to odoo #3428

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading