From 73db20293071b69e7cee75f46f612727366e702e Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Tue, 22 Sep 2020 09:54:50 +0000 Subject: [PATCH] [FIX] stock_account: take default credit/debit accounts from journal Create a product category with automated inventory valuation but no accounts defined for expense/income Create a stored product with such category but again without expense/income accounts. Create an invoice with such product and a jounral on which default credit/debit accounts are defined. Save and Post the invoice. Journal entries related to the inventory move (COGS) are not created because the accounts are missing, but the system should take the default defined on the jounral instead of skipping the operation opw-2339168 closes odoo/odoo#58662 X-original-commit: 3019828c1c101cdbf2f7d61a751ed6d73e40005f Signed-off-by: Laurent Smet Signed-off-by: agr-odoo --- addons/stock_account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_account/models/account_move.py b/addons/stock_account/models/account_move.py index 4b8c02f11cd..27828bcae75 100644 --- a/addons/stock_account/models/account_move.py +++ b/addons/stock_account/models/account_move.py @@ -122,7 +122,7 @@ class AccountMove(models.Model): .get_product_accounts(fiscal_pos=move.fiscal_position_id) ) debit_interim_account = accounts['stock_output'] - credit_expense_account = accounts['expense'] + credit_expense_account = accounts['expense'] or self.journal_id.default_account_id if not debit_interim_account or not credit_expense_account: continue