Skip to content

Commit

Permalink
[FIX] account: fix PO line matching on XML bill
Browse files Browse the repository at this point in the history
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#159139

X-original-commit: fc6b71c
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
  • Loading branch information
kitan191 committed Mar 26, 2024
1 parent d3b8f05 commit 8dd03a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/account/models/account_move.py
Expand Up @@ -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

# -------------------------------------------------------------------------
Expand Down

0 comments on commit 8dd03a3

Please sign in to comment.