Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP][14.0] l10n_vn: additional migration on 14.0 #271

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions openupgrade_scripts/scripts/l10n_vn/14.0.2.0.1/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)