[FIX] stock_account: validate invoice for product with non-reconcilable account
With Anglo-Saxon accounting, invoices with stock_moves on a product having 'real_time' valuation cannot be validated: there is a user error when the interim account is not reconcilable. We modify _anglo_saxon_reconcile_valuation so that we do not try to reconcile when the account is not reconcilable. OPW-2080180 closes odoo/odoo#39167 X-original-commit: 7174bd2f508f33454b7167de7d01ca8824404bf9 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user