Skip to content

Commit

Permalink
[MIG] l10n_vn: migrate to 17.0 (#655)
Browse files Browse the repository at this point in the history
* [MIG] l10n_vn: migration 17.0

* Update openupgrade_scripts/scripts/l10n_vn/17.0.2.0.3/pre-migration.py

---------

Co-authored-by: Roy Le <[email protected]>
  • Loading branch information
duong77476-viindoo and royle-vietnam authored Jun 7, 2024
1 parent e8819b3 commit 87364f0
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docsource/modules160-170.rst
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ Module coverage 16.0 -> 17.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_ve | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_vn | | |
| l10n_vn |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_za | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
43 changes: 43 additions & 0 deletions openupgrade_scripts/scripts/l10n_vn/17.0.2.0.3/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade

_account_tax_group_xmlid = [
"l10n_vn.tax_group_0",
"l10n_vn.tax_group_10",
"l10n_vn.tax_group_5",
]

_account_tax_xmlid = [
"l10n_vn.tax_purchase_vat0",
"l10n_vn.tax_purchase_vat10",
"l10n_vn.tax_purchase_vat5",
"l10n_vn.tax_sale_vat0",
"l10n_vn.tax_sale_vat10",
"l10n_vn.tax_sale_vat5",
]


def _vn_coa_rename_xml_id(env):
"""
Since the removal of account.chart.template
we need to rename some xml_id like tax or tax.group
in order to avoid duplication
"""
env.cr.execute("""SELECT id FROM res_company WHERE chart_template = 'vn'""")
xmlids_renames = []
for company_id in env.cr.fetchall():
for tax_group_xmlid in _account_tax_group_xmlid:
old_xmlid = f"l10n_vn.{company_id}_" + tax_group_xmlid.split(".")[1]
new_xmlid = f"account.{company_id}_" + tax_group_xmlid.split(".")[1]
xmlids_renames.append((old_xmlid, new_xmlid))
for tax_xmlid in _account_tax_xmlid:
old_xmlid = f"l10n_vn.{company_id}_" + tax_xmlid.split(".")[1]
new_xmlid = f"account.{company_id}_" + tax_xmlid.split(".")[1]
xmlids_renames.append((old_xmlid, new_xmlid))
openupgrade.rename_xmlids(env.cr, xmlids_renames)


@openupgrade.migrate()
def migrate(env, version):
_vn_coa_rename_xml_id(env)
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
---Models in module 'l10n_vn'---
---Fields in module 'l10n_vn'---
l10n_vn / res.partner.bank / proxy_type (False) : NEW selection_keys: ['atm_card', 'bank_acc', 'email', 'ewallet_id', 'id', 'merchant_id', 'merchant_tax_id', 'mobile', 'none', 'payment_service', 'uen'], mode: modify
# NOTHING TO DO

---XML records in module 'l10n_vn'---
DEL account.account.template: l10n_vn.chart1121
DEL account.account.template: l10n_vn.chart1122
DEL account.account.template: l10n_vn.chart1123
DEL account.account.template: l10n_vn.chart1211
DEL account.account.template: l10n_vn.chart1212
DEL account.account.template: l10n_vn.chart1218
DEL account.account.template: l10n_vn.chart1281
DEL account.account.template: l10n_vn.chart1282
DEL account.account.template: l10n_vn.chart1283
DEL account.account.template: l10n_vn.chart1288
DEL account.account.template: l10n_vn.chart131
DEL account.account.template: l10n_vn.chart132
DEL account.account.template: l10n_vn.chart1331
DEL account.account.template: l10n_vn.chart1332
DEL account.account.template: l10n_vn.chart1361
DEL account.account.template: l10n_vn.chart1362
DEL account.account.template: l10n_vn.chart1363
DEL account.account.template: l10n_vn.chart1368
DEL account.account.template: l10n_vn.chart1381
DEL account.account.template: l10n_vn.chart1385
DEL account.account.template: l10n_vn.chart1388
DEL account.account.template: l10n_vn.chart141
DEL account.account.template: l10n_vn.chart151
DEL account.account.template: l10n_vn.chart152
DEL account.account.template: l10n_vn.chart1531
DEL account.account.template: l10n_vn.chart1532
DEL account.account.template: l10n_vn.chart1533
DEL account.account.template: l10n_vn.chart1534
DEL account.account.template: l10n_vn.chart1541
DEL account.account.template: l10n_vn.chart1542
DEL account.account.template: l10n_vn.chart1543
DEL account.account.template: l10n_vn.chart1544
DEL account.account.template: l10n_vn.chart1551
DEL account.account.template: l10n_vn.chart1557
DEL account.account.template: l10n_vn.chart1561
DEL account.account.template: l10n_vn.chart1562
DEL account.account.template: l10n_vn.chart1567
DEL account.account.template: l10n_vn.chart157
DEL account.account.template: l10n_vn.chart158
DEL account.account.template: l10n_vn.chart1611
DEL account.account.template: l10n_vn.chart1612
DEL account.account.template: l10n_vn.chart171
DEL account.account.template: l10n_vn.chart2111
DEL account.account.template: l10n_vn.chart2112
DEL account.account.template: l10n_vn.chart2113
DEL account.account.template: l10n_vn.chart2114
DEL account.account.template: l10n_vn.chart2115
DEL account.account.template: l10n_vn.chart2118
DEL account.account.template: l10n_vn.chart2121
DEL account.account.template: l10n_vn.chart2122
DEL account.account.template: l10n_vn.chart2131
DEL account.account.template: l10n_vn.chart2132
DEL account.account.template: l10n_vn.chart2133
DEL account.account.template: l10n_vn.chart2134
DEL account.account.template: l10n_vn.chart2135
DEL account.account.template: l10n_vn.chart2136
DEL account.account.template: l10n_vn.chart2138
DEL account.account.template: l10n_vn.chart2141
DEL account.account.template: l10n_vn.chart2142
DEL account.account.template: l10n_vn.chart2143
DEL account.account.template: l10n_vn.chart2147
DEL account.account.template: l10n_vn.chart217
DEL account.account.template: l10n_vn.chart221
DEL account.account.template: l10n_vn.chart222
DEL account.account.template: l10n_vn.chart2281
DEL account.account.template: l10n_vn.chart2291
DEL account.account.template: l10n_vn.chart2292
DEL account.account.template: l10n_vn.chart2293
DEL account.account.template: l10n_vn.chart2294
DEL account.account.template: l10n_vn.chart2411
DEL account.account.template: l10n_vn.chart2412
DEL account.account.template: l10n_vn.chart2413
DEL account.account.template: l10n_vn.chart242
DEL account.account.template: l10n_vn.chart243
DEL account.account.template: l10n_vn.chart244
DEL account.account.template: l10n_vn.chart331
DEL account.account.template: l10n_vn.chart33311
DEL account.account.template: l10n_vn.chart33312
DEL account.account.template: l10n_vn.chart3332
DEL account.account.template: l10n_vn.chart3333
DEL account.account.template: l10n_vn.chart3334
DEL account.account.template: l10n_vn.chart3335
DEL account.account.template: l10n_vn.chart3336
DEL account.account.template: l10n_vn.chart3337
DEL account.account.template: l10n_vn.chart33381
DEL account.account.template: l10n_vn.chart33382
DEL account.account.template: l10n_vn.chart3339
DEL account.account.template: l10n_vn.chart3341
DEL account.account.template: l10n_vn.chart3348
DEL account.account.template: l10n_vn.chart335
DEL account.account.template: l10n_vn.chart3361
DEL account.account.template: l10n_vn.chart3362
DEL account.account.template: l10n_vn.chart3363
DEL account.account.template: l10n_vn.chart3368
DEL account.account.template: l10n_vn.chart337
DEL account.account.template: l10n_vn.chart3381
DEL account.account.template: l10n_vn.chart3382
DEL account.account.template: l10n_vn.chart3383
DEL account.account.template: l10n_vn.chart3384
DEL account.account.template: l10n_vn.chart3385
DEL account.account.template: l10n_vn.chart3386
DEL account.account.template: l10n_vn.chart3387
DEL account.account.template: l10n_vn.chart3388
DEL account.account.template: l10n_vn.chart3411
DEL account.account.template: l10n_vn.chart3412
DEL account.account.template: l10n_vn.chart3431
DEL account.account.template: l10n_vn.chart34311
DEL account.account.template: l10n_vn.chart34312
DEL account.account.template: l10n_vn.chart34313
DEL account.account.template: l10n_vn.chart3432
DEL account.account.template: l10n_vn.chart344
DEL account.account.template: l10n_vn.chart347
DEL account.account.template: l10n_vn.chart3521
DEL account.account.template: l10n_vn.chart3522
DEL account.account.template: l10n_vn.chart3523
DEL account.account.template: l10n_vn.chart3524
DEL account.account.template: l10n_vn.chart3531
DEL account.account.template: l10n_vn.chart3532
DEL account.account.template: l10n_vn.chart3533
DEL account.account.template: l10n_vn.chart3534
DEL account.account.template: l10n_vn.chart3561
DEL account.account.template: l10n_vn.chart3562
DEL account.account.template: l10n_vn.chart357
DEL account.account.template: l10n_vn.chart41111
DEL account.account.template: l10n_vn.chart41112
DEL account.account.template: l10n_vn.chart4112
DEL account.account.template: l10n_vn.chart4113
DEL account.account.template: l10n_vn.chart4118
DEL account.account.template: l10n_vn.chart412
DEL account.account.template: l10n_vn.chart4131
DEL account.account.template: l10n_vn.chart4132
DEL account.account.template: l10n_vn.chart414
DEL account.account.template: l10n_vn.chart417
DEL account.account.template: l10n_vn.chart418
DEL account.account.template: l10n_vn.chart419
DEL account.account.template: l10n_vn.chart4211
DEL account.account.template: l10n_vn.chart4212
DEL account.account.template: l10n_vn.chart441
DEL account.account.template: l10n_vn.chart4611
DEL account.account.template: l10n_vn.chart4612
DEL account.account.template: l10n_vn.chart466
DEL account.account.template: l10n_vn.chart5111
DEL account.account.template: l10n_vn.chart5112
DEL account.account.template: l10n_vn.chart5113
DEL account.account.template: l10n_vn.chart5114
DEL account.account.template: l10n_vn.chart5117
DEL account.account.template: l10n_vn.chart5118
DEL account.account.template: l10n_vn.chart515
DEL account.account.template: l10n_vn.chart5211
DEL account.account.template: l10n_vn.chart5212
DEL account.account.template: l10n_vn.chart5213
DEL account.account.template: l10n_vn.chart6111
DEL account.account.template: l10n_vn.chart621
DEL account.account.template: l10n_vn.chart622
DEL account.account.template: l10n_vn.chart6231
DEL account.account.template: l10n_vn.chart6232
DEL account.account.template: l10n_vn.chart6233
DEL account.account.template: l10n_vn.chart6234
DEL account.account.template: l10n_vn.chart6237
DEL account.account.template: l10n_vn.chart6238
DEL account.account.template: l10n_vn.chart6271
DEL account.account.template: l10n_vn.chart6272
DEL account.account.template: l10n_vn.chart6273
DEL account.account.template: l10n_vn.chart6274
DEL account.account.template: l10n_vn.chart6277
DEL account.account.template: l10n_vn.chart6278
DEL account.account.template: l10n_vn.chart631
DEL account.account.template: l10n_vn.chart632
DEL account.account.template: l10n_vn.chart635
DEL account.account.template: l10n_vn.chart6411
DEL account.account.template: l10n_vn.chart6412
DEL account.account.template: l10n_vn.chart6413
DEL account.account.template: l10n_vn.chart6414
DEL account.account.template: l10n_vn.chart6415
DEL account.account.template: l10n_vn.chart6417
DEL account.account.template: l10n_vn.chart6418
DEL account.account.template: l10n_vn.chart6421
DEL account.account.template: l10n_vn.chart6422
DEL account.account.template: l10n_vn.chart6423
DEL account.account.template: l10n_vn.chart6424
DEL account.account.template: l10n_vn.chart6425
DEL account.account.template: l10n_vn.chart6426
DEL account.account.template: l10n_vn.chart6427
DEL account.account.template: l10n_vn.chart6428
DEL account.account.template: l10n_vn.chart711
DEL account.account.template: l10n_vn.chart811
DEL account.account.template: l10n_vn.chart8211
DEL account.account.template: l10n_vn.chart8212
DEL account.account.template: l10n_vn.chart911
DEL account.account.template: l10n_vn.chart9993
DEL account.account.template: l10n_vn.chart9994
DEL account.chart.template: l10n_vn.vn_template
NEW account.report.expression: l10n_vn.account_tax_report_line_04_02_01_vn_tag
NEW account.report.expression: l10n_vn.account_tax_report_line_04_02_02_vn_tag
NEW account.report.line: l10n_vn.account_tax_report_line_04_02_01_vn
NEW account.report.line: l10n_vn.account_tax_report_line_04_02_02_vn
NEW ir.ui.view: l10n_vn.view_partner_bank_form_inherit_account
# NOTHING TO DO

DEL account.tax.group: l10n_vn.tax_group_0 (noupdate)
DEL account.tax.group: l10n_vn.tax_group_10 (noupdate)
DEL account.tax.group: l10n_vn.tax_group_5 (noupdate)
DEL account.tax.template: l10n_vn.tax_purchase_vat0
DEL account.tax.template: l10n_vn.tax_purchase_vat10
DEL account.tax.template: l10n_vn.tax_purchase_vat5
DEL account.tax.template: l10n_vn.tax_sale_vat0
DEL account.tax.template: l10n_vn.tax_sale_vat10
DEL account.tax.template: l10n_vn.tax_sale_vat5
# DONE pre-migration: rename xml_id

0 comments on commit 87364f0

Please sign in to comment.