[FIX] mrp_multi_level: Correct main supplier when changing sequence in Vendor Pricelist

When we change the sequence order of the Vendor Pricelist for a product, we firstly fetch the vendors and then we change the sequence. Then, when changing a sequence we try to get the first supplier but we do not get the desired result.
Reordering the suppliers allows to always get the first supplier in the list.
This commit is contained in:
BernatPForgeFlow
2023-11-27 17:17:01 +01:00
committed by JasminSForgeFlow
parent dfecd6ee69
commit b9eeb3c36e

View File

@@ -223,7 +223,7 @@ class ProductMRPArea(models.Model):
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)
)
).sorted(lambda s: (s.sequence, -s.min_qty, s.price, s.id))
if not suppliers:
rec.main_supplierinfo_id = False
rec.main_supplier_id = False