From b94519e6e891bd830b59deb7005a9349efaa8133 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 19 Nov 2020 11:07:41 +0000 Subject: [PATCH] [FIX] account: account creation - Install accounting app - Go to "Charts of Accounts" view by setup panel - Create a new record A traceback occurs because `self.ids` is empty in the context of the creation of a new record. opw-2379463 closes odoo/odoo#62014 X-original-commit: b325266bc9d3893e037b3fd8d734ac7d3d510c41 Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_account.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py index da1cc0cf0c1..1aa6c558bf8 100644 --- a/addons/account/models/account_account.py +++ b/addons/account/models/account_account.py @@ -224,7 +224,10 @@ class AccountAccount(models.Model): raise UserError(_('Cannot generate an unused account code.')) def _compute_opening_debit_credit(self): - if not self: + self.opening_debit = 0 + self.opening_credit = 0 + self.opening_balance = 0 + if not self.ids: return self.env.cr.execute(""" SELECT line.account_id,