[FIX] account: Prevent crash when having custom coa

- Create manually an account.payment after having created manually some journals
(without installing a coa).
- Install a module containing a coa and calling try_loading_for_current_company or depending
of other module doing such things.

=> Crash because company.chart_template_id is not set.

-opw: 1921711

closes odoo/odoo#30117
This commit is contained in:
Laurent Smet
2019-01-10 13:53:14 +00:00
parent a7cbac305e
commit ec25b9d01b
+3 -2
View File
@@ -142,8 +142,9 @@ class AccountChartTemplate(models.Model):
'bank_account_code_prefix': self.bank_account_code_prefix, 'bank_account_code_prefix': self.bank_account_code_prefix,
'cash_account_code_prefix': self.cash_account_code_prefix, 'cash_account_code_prefix': self.cash_account_code_prefix,
}) })
wizard.onchange_chart_template_id() if not wizard.existing_accounting(company):
wizard.execute() wizard.onchange_chart_template_id()
wizard.execute()
@api.multi @api.multi
def open_select_template_wizard(self): def open_select_template_wizard(self):