Skip to content
Snippets Groups Projects
Commit 8928dfe7 authored by wan's avatar wan
Browse files

[FIX] account: change CoA even if one already installed


Because the tax closing entry is created (empty) at the creation of the
CoA, it is not possible anymore to change it later, even if the user
didn't create any journal entry.
By checking that there are no account.move.line instead of account.move,
and also there are no entries with a name different from '/' (to ensure
that the sequences are untouched) we can change the CoA if needed.

closes odoo/odoo#44647

Signed-off-by: default avatarLaurent Smet <smetl@users.noreply.github.com>
parent f830bf49
No related branches found
No related tags found
No related merge requests found
......@@ -262,10 +262,12 @@ class AccountChartTemplate(models.Model):
the provided company (meaning hence that its chart of accounts cannot
be changed anymore).
"""
model_to_check = ['account.move', 'account.payment', 'account.bank.statement']
model_to_check = ['account.move.line', 'account.payment', 'account.bank.statement']
for model in model_to_check:
if self.env[model].sudo().search([('company_id', '=', company_id.id)], limit=1):
return True
if self.env['account.move'].sudo().search([('company_id', '=', company_id.id), ('name', '!=', '/')], limit=1):
return True
return False
def _create_tax_templates_from_rates(self, company_id, sale_tax_rate, purchase_tax_rate):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment