From 8dd03a3059431de939f33ded00f4b2c3656f25e3 Mon Sep 17 00:00:00 2001 From: "Anh Thao Pham (pta)" Date: Mon, 18 Mar 2024 15:32:15 +0100 Subject: [PATCH] [FIX] account: fix PO line matching on XML bill Steps to reproduce: - Install Accounting and Purchase - Install a localization that supports electronic invoice (e.g. l10n_it_edi) - Switch to a company with that localization - Go to Purchase and create a PO: * Vendor: Vendor X * Product: Product X * Unit Price: 50.00 - Create an electronic bill in XML format with: * a reference to PO name * the same partner than the PO * the same line than the PO, except for the price (e.g. 200.00) - Go to "Accounting / Vendors / Bills" - Upload the XML bill Issue: The bill is generated and linked to the PO, but the price and subtotal on the bill line is the one coming from the PO instead of the one coming from the XML. Values coming from an imported XML should not be overridden by values found in matching PO. Cause: "timeout" parameter is wrongly passed as "prefer_purchase_line" parameter in a call to "_find_and_set_purchase_orders" method. opw-3707731 closes odoo/odoo#159139 X-original-commit: fc6b71c649c17c7534cdc9b9853d75b58076a823 Signed-off-by: Claire Bretton (clbr) Signed-off-by: Anh Thao Pham (pta) --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 681394a944a76..bcbca5c8a391a 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3929,7 +3929,7 @@ def _find_and_set_purchase_orders(self, po_references, partner_id, amount_total, def _link_bill_origin_to_purchase_orders(self, timeout=10): for move in self.filtered(lambda m: m.move_type in self.get_purchase_types()): references = [move.invoice_origin] if move.invoice_origin else [] - move._find_and_set_purchase_orders(references, move.partner_id.id, move.amount_total, timeout) + move._find_and_set_purchase_orders(references, move.partner_id.id, move.amount_total, timeout=timeout) return self # -------------------------------------------------------------------------