From ec25b9d01b27b33339d64c4833563c4f1c987dc8 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Thu, 10 Jan 2019 13:36:09 +0000 Subject: [PATCH] [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 --- addons/account/models/chart_template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 2718f7e67ce..0742516c930 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -142,8 +142,9 @@ class AccountChartTemplate(models.Model): 'bank_account_code_prefix': self.bank_account_code_prefix, 'cash_account_code_prefix': self.cash_account_code_prefix, }) - wizard.onchange_chart_template_id() - wizard.execute() + if not wizard.existing_accounting(company): + wizard.onchange_chart_template_id() + wizard.execute() @api.multi def open_select_template_wizard(self):