[FIX] account: prevent trackback when installing stock_account after uninstall any l10n

Before commit
1. install the localisation module
2. uninstall that module
3. try to install stock
   - traceback is generated - https://pastebin.com/eGGYZ1k1
After commit
applying this commit will fix this issue

sentry - 4184561125

closes odoo/odoo#122556

X-original-commit: 95a67a24870f7ca0e9d9f865ce0279aca9fa2699
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
Zeel Patel
2023-05-30 15:39:48 +02:00
parent 9af60a5092
commit baef8c5322
+7
View File
@@ -84,3 +84,10 @@ class IrModule(models.Model):
self.env.company,
)
del self.env.registry._auto_install_template
def module_uninstall(self):
unlinked_templates = [code for template in self.mapped('account_templates') for code in template]
self.env['res.company'].search([
('chart_template', 'in', unlinked_templates),
]).chart_template = False
return super().module_uninstall()