From 3d89b4f9680a93682f0ff3e64076ac7ed1a22c5e Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 5 Dec 2024 12:49:39 +0100 Subject: [PATCH] [14.0][IMP] product_pricelist_last_purchase_price: If find more than one product supplierinfo, take the one with the lowest sequence. --- product_pricelist_last_purchase_price/models/account_move.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/product_pricelist_last_purchase_price/models/account_move.py b/product_pricelist_last_purchase_price/models/account_move.py index 6302172e02..098a5c8b0a 100644 --- a/product_pricelist_last_purchase_price/models/account_move.py +++ b/product_pricelist_last_purchase_price/models/account_move.py @@ -93,6 +93,8 @@ def _find_seller_to_update_suppliernfo_to_product(self, line, partner): lambda x: x.name == partner and (x.price != line.price_unit or x.discount != line.discount) ) + if len(seller) > 1: + seller = min(seller, key=lambda x: x.sequence) if seller and seller.not_update_price_from_invoice: seller = False return seller