From baef8c532266d858ae2cc53498086e246d269ffe Mon Sep 17 00:00:00 2001 From: Zeel Patel Date: Tue, 23 May 2023 05:53:32 +0000 Subject: [PATCH] [FIX] account: prevent trackback when installing stock_account after uninstall any l10n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/account/models/ir_module.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/account/models/ir_module.py b/addons/account/models/ir_module.py index 21089d61730..430c1737a12 100644 --- a/addons/account/models/ir_module.py +++ b/addons/account/models/ir_module.py @@ -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()