[FIX] account: fix switching of CoA with only Invoicing app installed
When only Invoicing app is installed, trying to switch from a CoA with
reconcile model result in the following error:
You are not allowed to delete 'Preset to create journal entries during a invoices and payments matching' (account.reconcile.model) records.
This operation is allowed for the following groups:
- Technical/Show Full Accounting Features
Contact your administrator to request access if necessary.
As we already checked that user doing that operation is an admin., we
do remove the preceding CoA a superuser (like it was done precedingly
in saas~16.1).
To reproduce:
- Install a database without demo data and choose "Germany" as country
- Install "Invoicing" app
* this automatically install SKR 03 chart of account *
- Go to Settings / Invoicing, switch chart template to SKR 04 and Save
* raise the error above *
closes odoo/odoo#117788
X-original-commit: 87af732ba99b0fd79a98aa0c0c09ca1f737f9955
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Xavier Alt (xal) <xal@odoo.com>
This commit is contained in:
@@ -173,7 +173,7 @@ class AccountChartTemplate(models.AbstractModel):
|
||||
|
||||
if not reload_template:
|
||||
for model in ('account.move',) + TEMPLATE_MODELS[::-1]:
|
||||
self.env[model].search([('company_id', '=', company.id)]).with_context({MODULE_UNINSTALL_FLAG: True}).unlink()
|
||||
self.env[model].sudo().search([('company_id', '=', company.id)]).with_context({MODULE_UNINSTALL_FLAG: True}).unlink()
|
||||
|
||||
data = self._get_chart_template_data(template_code)
|
||||
template_data = data.pop('template_data')
|
||||
|
||||
Reference in New Issue
Block a user