[FIX] account: handle upgrade of modules

closes odoo/odoo#116762

X-original-commit: 892db541b9474b2fc4ed4da36f1917720a07d1e4
Signed-off-by: Christophe Simonis <chs@odoo.com>
This commit is contained in:
Christophe Simonis
2023-03-28 13:43:52 +02:00
parent 4aaad55e57
commit b84c846fe4
+1 -1
View File
@@ -60,7 +60,7 @@ class IrModule(models.Model):
def write(self, vals):
# Instanciate the first template of the module on the current company upon installing the module
was_installed = len(self) == 1 and self.state == 'installed'
was_installed = len(self) == 1 and self.state in ('installed', 'to upgrade', 'to remove')
super().write(vals)
is_installed = len(self) == 1 and self.state == 'installed'
if not was_installed and is_installed and not self.env.company.chart_template and self.account_templates: