From e19bbf8c8974c88601c4f0e4e7cd42d877e3a5e0 Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Thu, 9 Mar 2023 10:18:52 +0000 Subject: [PATCH] [FIX] stock_account: reconcile same product only -Create 3 products with different costing methods: AVCO, FIFO, Standard -Create a PO for the 3 items (same quantity and unit price in every line) -Receive -Create Vendor Bill -Check Journal items. You will notice that the AVCO product is marked as partially matched. Please keep in mind that this only happens when the 3 costings are used and the unit price is the same. It happes because `_get_all_related_aml` returns all the `account.move.line` for the journal entry and invoice. But not only for the current product. So if they share the same price unit then it could reconcile lines for different products. X-original-commit: 23ccf2c1bde84f03aaaedb206e37a35de701da5e Part-of: odoo/odoo#114987 --- addons/stock_account/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/models/account_move.py b/addons/stock_account/models/account_move.py index a8bc2efe279..d767f35cd17 100644 --- a/addons/stock_account/models/account_move.py +++ b/addons/stock_account/models/account_move.py @@ -235,7 +235,8 @@ class AccountMove(models.Model): # Search for anglo-saxon lines linked to the product in the stock moves. product_stock_moves = stock_moves.filtered(lambda stock_move: stock_move.product_id == prod) product_account_moves |= product_stock_moves._get_all_related_aml().filtered( - lambda line: line.account_id == product_interim_account and not line.reconciled and line.move_id.state == "posted" + lambda line: line.account_id == product_interim_account and not line.reconciled and line.move_id.state == "posted" and + line.product_id == prod ) # Reconcile.