mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
@@ -231,11 +231,18 @@ class ProductMRPArea(models.Model):
|
|||||||
rec.supply_bom_id = False
|
rec.supply_bom_id = False
|
||||||
|
|
||||||
@api.depends(
|
@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):
|
def _compute_main_supplier(self):
|
||||||
"""Simplified and similar to procurement.rule logic."""
|
"""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(
|
suppliers = rec.product_id.seller_ids.filtered(
|
||||||
lambda r: (not r.product_id or r.product_id == rec.product_id)
|
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)
|
and (not r.company_id or r.company_id == rec.company_id)
|
||||||
@@ -246,9 +253,6 @@ class ProductMRPArea(models.Model):
|
|||||||
continue
|
continue
|
||||||
rec.main_supplierinfo_id = suppliers[0]
|
rec.main_supplierinfo_id = suppliers[0]
|
||||||
rec.main_supplier_id = suppliers[0].partner_id
|
rec.main_supplier_id = suppliers[0].partner_id
|
||||||
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):
|
def _adjust_qty_to_order(self, qty_to_order):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|||||||
Reference in New Issue
Block a user