From ac62af7e251a533327e41e5a762efb673335e7b7 Mon Sep 17 00:00:00 2001 From: jepbarasgarov Date: Tue, 23 Jan 2024 12:21:29 +0000 Subject: [PATCH] [FIX] l10n_ch: remove depricated account_report_external_value In module `l10n_ch` after this commit https://github.com/odoo/odoo/commit/7a06ed07814ab8d9192d3a7ec15aba7f90f7294d `account_report_expression` with name `account_tax_report_line_chtax_solde_formula` will be depricated but it can't be deleted by upgrade because it has dependent external values. On this commit I removed that depricated external values of that expression closes odoo/odoo#151426 X-original-commit: b26f2e24f3e70e26bc98aafe0e87735a1256a9cd Signed-off-by: Olivier Colson (oco) --- addons/l10n_ch/__manifest__.py | 2 +- addons/l10n_ch/migrations/11.2/pre-migrate.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 addons/l10n_ch/migrations/11.2/pre-migrate.py diff --git a/addons/l10n_ch/__manifest__.py b/addons/l10n_ch/__manifest__.py index f5d3be898cb..ef172d008bb 100644 --- a/addons/l10n_ch/__manifest__.py +++ b/addons/l10n_ch/__manifest__.py @@ -19,7 +19,7 @@ A QR-bill will be generated if: The generation of the QR-bill is automatic if you meet the previous criteria. The QR-bill will be appended after the invoice when printing or sending by mail. """, - 'version': '11.1', + 'version': '11.2', 'category': 'Accounting/Localizations/Account Charts', 'depends': [ 'account', diff --git a/addons/l10n_ch/migrations/11.2/pre-migrate.py b/addons/l10n_ch/migrations/11.2/pre-migrate.py new file mode 100644 index 00000000000..d8c92761b81 --- /dev/null +++ b/addons/l10n_ch/migrations/11.2/pre-migrate.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + + +def migrate(cr, version): + cr.execute("SELECT res_id FROM ir_model_data WHERE module = 'l10n_ch' AND name='account_tax_report_line_chtax_solde_formula'") + + expression_id = cr.fetchone() + + if expression_id: + cr.execute( + "DELETE FROM account_report_external_value WHERE target_report_expression_id = %s", + [expression_id[0]] + )