diff --git a/addons/stock_account/models/account_move.py b/addons/stock_account/models/account_move.py index 988ca85fa09..6c39f5f6034 100644 --- a/addons/stock_account/models/account_move.py +++ b/addons/stock_account/models/account_move.py @@ -183,17 +183,18 @@ class AccountMove(models.Model): else: product_interim_account = product_accounts['stock_input'] - # Search for anglo-saxon lines linked to the product in the journal entry. - product_account_moves = move.line_ids.filtered( - lambda line: line.product_id == product and line.account_id == product_interim_account and not line.reconciled) + if product_interim_account.reconcile: + # Search for anglo-saxon lines linked to the product in the journal entry. + product_account_moves = move.line_ids.filtered( + lambda line: line.product_id == product and line.account_id == product_interim_account and not line.reconciled) - # 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 == product) - product_account_moves += product_stock_moves.mapped('account_move_ids.line_ids')\ - .filtered(lambda line: line.account_id == product_interim_account and not line.reconciled) + # 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 == product) + product_account_moves += product_stock_moves.mapped('account_move_ids.line_ids')\ + .filtered(lambda line: line.account_id == product_interim_account and not line.reconciled) - # Reconcile. - product_account_moves.reconcile() + # Reconcile. + product_account_moves.reconcile() class AccountMoveLine(models.Model):