[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) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-11-19 12:37:25 +00:00
parent d16343a41d
commit b94519e6e8
+4 -1
View File
@@ -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,