Skip to content
Snippets Groups Projects
Commit 7174bd2f authored by fw-bot's avatar fw-bot Committed by oco-odoo
Browse files

[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#38974

Signed-off-by: default avataroco-odoo <oco-odoo@users.noreply.github.com>
parent aa33704a
No related branches found
No related tags found
No related merge requests found
......@@ -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)
# 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()
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)
# Reconcile.
product_account_moves.reconcile()
class AccountMoveLine(models.Model):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment