From 56331c1a755f8ef71b1c7eda38b13e94f26543da Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Thu, 1 Aug 2019 07:55:48 +0000 Subject: [PATCH] [FIX] account: unlink data when installing chart of account When a chart of account is installed, it first remove all existing existing data. If you don't have account_accountant module installed, but you have create a bank or cash journal (through the POS for example). Some accounts have been created and the installation of chart template is trying to remove some models, but as the account_accountant you don't have access write on model 'account.reconcile.model'. --- addons/account/models/chart_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 94c63d9de70..e93aaa65485 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -214,7 +214,7 @@ class AccountChartTemplate(models.Model): # delete account, journal, tax, fiscal position and reconciliation model models_to_delete = ['account.reconcile.model', 'account.fiscal.position', 'account.tax', 'account.move', 'account.journal'] for model in models_to_delete: - res = self.env[model].search([('company_id', '=', company.id)]) + res = self.env[model].sudo().search([('company_id', '=', company.id)]) if len(res): res.unlink() existing_accounts.unlink()