[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#44659 X-original-commit: 8928dfe70867da3e40fa47f50bffa5dfd1976090 Signed-off-by: wan <william-andre@users.noreply.github.com>
This commit is contained in:
@@ -272,10 +272,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):
|
||||
|
||||
Reference in New Issue
Block a user