From 22aaa084bd94c67d0db0d0ecdbdd560326629f76 Mon Sep 17 00:00:00 2001 From: sang250399 Date: Thu, 23 Jun 2022 08:28:48 +0700 Subject: [PATCH] [IMP]l10n_vn: additional migration on 14.0 In 13.0 the name chart of accounts was Vietnamese, on 14.0 changed it to English --- .../l10n_vn/14.0.2.0.1/post-migration.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/openupgrade_scripts/scripts/l10n_vn/14.0.2.0.1/post-migration.py b/openupgrade_scripts/scripts/l10n_vn/14.0.2.0.1/post-migration.py index 20d6a6775603..b869cbae565e 100644 --- a/openupgrade_scripts/scripts/l10n_vn/14.0.2.0.1/post-migration.py +++ b/openupgrade_scripts/scripts/l10n_vn/14.0.2.0.1/post-migration.py @@ -24,8 +24,29 @@ def _create_new_vietnam_accounts(env): (company.id, vn_template.id, tuple(account_ids)), ) +def _update_en_name_accounts(env): + """update name to english to sync with improvements on 14.0""" + openupgrade.logged_query( + env.cr, + """ + UPDATE account_account AS aa + SET name = atp.name + FROM account_account_template AS atp + WHERE aa.code = atp.code + """, + ) + +def _override_ir_translations(env): + lang = env['res.lang'].search([('code', '=', 'vi_VN')]) + if lang: + mods = env['ir.module.module'].search([('state', '=', 'installed')]) + mods._update_translations(lang, True) + env.cr.execute('ANALYZE ir_translation') + @openupgrade.migrate() def migrate(env, version): openupgrade.load_data(env.cr, "l10n_vn", "14.0.2.0.1/noupdate_changes.xml") _create_new_vietnam_accounts(env) + _update_en_name_accounts(env) + _override_ir_translations(env)