Skip to content

Commit

Permalink
Merge PR #1453 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Jan 13, 2025
2 parents b43e73c + 9d006ac commit 5ef624b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mrp_multi_level/models/product_mrp_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,18 @@ def _compute_supply_method(self):
rec.supply_bom_id = False

@api.depends(
"mrp_area_id", "supply_method", "product_id.route_ids", "product_id.seller_ids"
"mrp_area_id",
"product_id.route_ids",
"product_id.seller_ids",
"location_proc_id",
)
def _compute_main_supplier(self):
"""Simplified and similar to procurement.rule logic."""
for rec in self.filtered(lambda r: r.supply_method == "buy"):
for rec in self:
if rec.supply_method != "buy":
rec.main_supplierinfo_id = False
rec.main_supplier_id = False
continue
suppliers = rec.product_id.seller_ids.filtered(
lambda r: (not r.product_id or r.product_id == rec.product_id)
and (not r.company_id or r.company_id == rec.company_id)
Expand All @@ -246,9 +253,6 @@ def _compute_main_supplier(self):
continue
rec.main_supplierinfo_id = suppliers[0]
rec.main_supplier_id = suppliers[0].name
for rec in self.filtered(lambda r: r.supply_method != "buy"):
rec.main_supplierinfo_id = False
rec.main_supplier_id = False

def _adjust_qty_to_order(self, qty_to_order):
self.ensure_one()
Expand Down

0 comments on commit 5ef624b

Please sign in to comment.