From 8df985bf1866e7c4eede8ee2ee3354126fdfd25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=C3=B4i=20=28Ki=C3=AAn=20Kim=29?= Date: Fri, 15 Nov 2024 12:22:48 +0700 Subject: [PATCH] [MIG] l10n_ch_account_tags: Migration to 18.0 --- checklog-odoo.cfg | 3 + l10n_ch_account_tags/__init__.py | 1 + l10n_ch_account_tags/__manifest__.py | 9 +- .../{template => }/account.account.tag-ch.csv | 0 .../data/new/account.account.tag.csv | 34 --- .../data/new/account.account.template.csv | 2 - .../data/template/account.account-ch.csv | 2 - .../data/update/account.account-ch.csv | 168 ------------- .../data/update/account.account.template.csv | 168 ------------- l10n_ch_account_tags/hooks.py | 234 ++++++++++++++++++ l10n_ch_account_tags/readme/CONTRIBUTORS.md | 1 + l10n_ch_account_tags/readme/CREDITS.md | 3 + .../static/description/index.html | 1 - 13 files changed, 245 insertions(+), 381 deletions(-) create mode 100644 checklog-odoo.cfg rename l10n_ch_account_tags/data/{template => }/account.account.tag-ch.csv (100%) delete mode 100644 l10n_ch_account_tags/data/new/account.account.tag.csv delete mode 100644 l10n_ch_account_tags/data/new/account.account.template.csv delete mode 100644 l10n_ch_account_tags/data/template/account.account-ch.csv delete mode 100644 l10n_ch_account_tags/data/update/account.account-ch.csv delete mode 100644 l10n_ch_account_tags/data/update/account.account.template.csv create mode 100644 l10n_ch_account_tags/hooks.py diff --git a/checklog-odoo.cfg b/checklog-odoo.cfg new file mode 100644 index 000000000..f5d40b020 --- /dev/null +++ b/checklog-odoo.cfg @@ -0,0 +1,3 @@ +[checklog-odoo] +ignore= + WARNING.*0 failed, 0 error\(s\).* diff --git a/l10n_ch_account_tags/__init__.py b/l10n_ch_account_tags/__init__.py index e69de29bb..4e54b2e83 100644 --- a/l10n_ch_account_tags/__init__.py +++ b/l10n_ch_account_tags/__init__.py @@ -0,0 +1 @@ +from .hooks import post_init diff --git a/l10n_ch_account_tags/__manifest__.py b/l10n_ch_account_tags/__manifest__.py index f5cca95f4..e8258541b 100644 --- a/l10n_ch_account_tags/__manifest__.py +++ b/l10n_ch_account_tags/__manifest__.py @@ -5,14 +5,11 @@ "name": "Switzerland Account Tags", "category": "Localisation", "summary": "", - "version": "16.0.1.0.0", + "version": "18.0.1.0.0", "author": "Camptocamp, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-switzerland", "license": "AGPL-3", "depends": ["l10n_ch"], - "data": [ - "data/new/account.account.tag.csv", - "data/new/account.account.template.csv", - "data/update/account.account.template.csv", - ], + "data": ["data/account.account.tag-ch.csv"], + "post_init_hook": "post_init", } diff --git a/l10n_ch_account_tags/data/template/account.account.tag-ch.csv b/l10n_ch_account_tags/data/account.account.tag-ch.csv similarity index 100% rename from l10n_ch_account_tags/data/template/account.account.tag-ch.csv rename to l10n_ch_account_tags/data/account.account.tag-ch.csv diff --git a/l10n_ch_account_tags/data/new/account.account.tag.csv b/l10n_ch_account_tags/data/new/account.account.tag.csv deleted file mode 100644 index 5b6d189da..000000000 --- a/l10n_ch_account_tags/data/new/account.account.tag.csv +++ /dev/null @@ -1,34 +0,0 @@ -id,name,applicability,color -account_tag_ch_60,Autres charges d‘exploitation (CH_60),accounts,4 -account_tag_ch_280,Capital social ou capital de fondation (CH_280),accounts,4 -account_tag_ch_68,Amortissements sur immobilisations corporelles (CH_68),accounts,4 -account_tag_ch_69,Résultat financier (CH_69),accounts,4 -account_tag_ch_180,Capital non versé : capital social - capital de fondation (CH_180),accounts,4 -account_tag_ch_148,Participations (CH_148),accounts,4 -account_tag_ch_220,Autres dettes à court terme (CH_220),accounts,4 -account_tag_ch_160,Immobilisations corporelles immeubles CH_160),accounts,4 -account_tag_ch_140,Immobilisations financières (CH_140),accounts,4 -account_tag_ch_89,Impôts directs (CH_89),accounts,4 -account_tag_ch_150,Immobilisations corporelles meubles (CH_150),accounts,4 -account_tag_ch_130,Actifs de régularisation (transitoires) (CH_130),accounts,4 -account_tag_ch_80,Résultat hors-exploitation (CH_80),accounts,4 -account_tag_ch_210,Dettes à court terme rémunérés (CH_210),accounts,4 -account_tag_ch_114,Autres créances à court terme (CH_114),accounts,4 -account_tag_ch_85,Résultat extraordinaires (CH_85),accounts,4 -account_tag_ch_110,Créances résultant de livraisons et prestations (CH_110),accounts,4 -account_tag_ch_297,Résultat de l'exercice (CH_297),accounts,4 -account_tag_ch_290,Réserves / bénéfices et pertes reportés (CH_290),accounts,4 -account_tag_ch_170,Immobilisations incorporelles (CH_170),accounts,4 -account_tag_ch_230,Passifs de régularisation (transitoires) et provisions à court terme (CH_230),accounts,4 -account_tag_ch_7,Résultat des activités annexes d'exploitation (CH_7),accounts,4 -account_tag_ch_5,Charges de personnel (CH_5),accounts,4 -account_tag_ch_4,Charges de marchandises et de matériel (CH_4),accounts,4 -account_tag_ch_200,Dettes à court terme résultant d’achats et de prestations de services (CH_200),accounts,4 -account_tag_ch_260,Provisions à long termes et provisions légales (CH_260),accounts,4 -account_tag_ch_120,Stocks et prestations non facturées (CH_120),accounts,4 -account_tag_ch_100,Trésorerie (CH_100),accounts,4 -account_tag_ch_106,Actifs à court terme cotés en bourse (CH_106),accounts,4 -account_tag_ch_240,Dettes à long terme rémunérées (CH_240),accounts,4 -account_tag_ch_39,Variation des stocks (CH_39),accounts,4 -account_tag_ch_250,Autres dettes à long terme (CH_250),accounts,4 -account_tag_ch_30,Chiffre d'affaires (CH_30),accounts,4 diff --git a/l10n_ch_account_tags/data/new/account.account.template.csv b/l10n_ch_account_tags/data/new/account.account.template.csv deleted file mode 100644 index f2679d59a..000000000 --- a/l10n_ch_account_tags/data/new/account.account.template.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,code,tag_ids/id,account_type -1_transfer_account_id,Transfer,1090,account_tag_ch_106,asset_current diff --git a/l10n_ch_account_tags/data/template/account.account-ch.csv b/l10n_ch_account_tags/data/template/account.account-ch.csv deleted file mode 100644 index 8a7c685da..000000000 --- a/l10n_ch_account_tags/data/template/account.account-ch.csv +++ /dev/null @@ -1,2 +0,0 @@ -"id","name","code","tag_ids/id","account_type" -"1_transfer_account_id","Transfer","1090","account_tag_ch_106","asset_current" diff --git a/l10n_ch_account_tags/data/update/account.account-ch.csv b/l10n_ch_account_tags/data/update/account.account-ch.csv deleted file mode 100644 index 68705d50e..000000000 --- a/l10n_ch_account_tags/data/update/account.account-ch.csv +++ /dev/null @@ -1,168 +0,0 @@ -id,tag_ids/id -"l10n_ch.ch_coa_1060","l10n_ch_account_tags.account_tag_ch_106" -"l10n_ch.ch_coa_1069","l10n_ch_account_tags.account_tag_ch_106" -"l10n_ch.ch_coa_1091","l10n_ch_account_tags.account_tag_ch_106" -"l10n_ch.ch_coa_1099","l10n_ch_account_tags.account_tag_ch_106" -"l10n_ch.ch_coa_1100","l10n_ch_account_tags.account_tag_ch_110" -"l10n_ch.ch_coa_1109","l10n_ch_account_tags.account_tag_ch_110" -"l10n_ch.ch_coa_1140","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1149","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1170","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1171","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1176","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1180","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1189","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1190","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1199","l10n_ch_account_tags.account_tag_ch_114" -"l10n_ch.ch_coa_1200","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1207","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1208","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1209","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1210","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1217","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1218","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1219","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1220","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1230","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1250","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1260","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1267","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1269","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1270","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1277","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1279","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1280","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1287","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1289","l10n_ch_account_tags.account_tag_ch_120" -"l10n_ch.ch_coa_1300","l10n_ch_account_tags.account_tag_ch_130" -"l10n_ch.ch_coa_1301","l10n_ch_account_tags.account_tag_ch_130" -"l10n_ch.ch_coa_1400","l10n_ch_account_tags.account_tag_ch_140" -"l10n_ch.ch_coa_1409","l10n_ch_account_tags.account_tag_ch_140" -"l10n_ch.ch_coa_1440","l10n_ch_account_tags.account_tag_ch_140" -"l10n_ch.ch_coa_1441","l10n_ch_account_tags.account_tag_ch_140" -"l10n_ch.ch_coa_1449","l10n_ch_account_tags.account_tag_ch_140" -"l10n_ch.ch_coa_1480","l10n_ch_account_tags.account_tag_ch_148" -"l10n_ch.ch_coa_1489","l10n_ch_account_tags.account_tag_ch_148" -"l10n_ch.ch_coa_1500","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1509","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1510","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1519","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1520","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1529","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1530","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1539","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1540","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1549","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1550","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1559","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1570","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1579","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1590","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1599","l10n_ch_account_tags.account_tag_ch_150" -"l10n_ch.ch_coa_1600","l10n_ch_account_tags.account_tag_ch_160" -"l10n_ch.ch_coa_1609","l10n_ch_account_tags.account_tag_ch_160" -"l10n_ch.ch_coa_1700","l10n_ch_account_tags.account_tag_ch_170" -"l10n_ch.ch_coa_1709","l10n_ch_account_tags.account_tag_ch_170" -"l10n_ch.ch_coa_1770","l10n_ch_account_tags.account_tag_ch_170" -"l10n_ch.ch_coa_1779","l10n_ch_account_tags.account_tag_ch_170" -"l10n_ch.ch_coa_1850","l10n_ch_account_tags.account_tag_ch_180" -"l10n_ch.ch_coa_2000","l10n_ch_account_tags.account_tag_ch_200" -"l10n_ch.ch_coa_2030","l10n_ch_account_tags.account_tag_ch_200" -"l10n_ch.ch_coa_2100","l10n_ch_account_tags.account_tag_ch_210" -"l10n_ch.ch_coa_2120","l10n_ch_account_tags.account_tag_ch_210" -"l10n_ch.ch_coa_2140","l10n_ch_account_tags.account_tag_ch_210" -"l10n_ch.ch_coa_2160","l10n_ch_account_tags.account_tag_ch_210" -"l10n_ch.ch_coa_2200","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2201","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2206","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2208","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2210","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2261","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2270","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2279","l10n_ch_account_tags.account_tag_ch_220" -"l10n_ch.ch_coa_2300","l10n_ch_account_tags.account_tag_ch_230" -"l10n_ch.ch_coa_2301","l10n_ch_account_tags.account_tag_ch_230" -"l10n_ch.ch_coa_2330","l10n_ch_account_tags.account_tag_ch_230" -"l10n_ch.ch_coa_2400","l10n_ch_account_tags.account_tag_ch_240" -"l10n_ch.ch_coa_2420","l10n_ch_account_tags.account_tag_ch_240" -"l10n_ch.ch_coa_2430","l10n_ch_account_tags.account_tag_ch_240" -"l10n_ch.ch_coa_2450","l10n_ch_account_tags.account_tag_ch_240" -"l10n_ch.ch_coa_2451","l10n_ch_account_tags.account_tag_ch_240" -"l10n_ch.ch_coa_2500","l10n_ch_account_tags.account_tag_ch_250" -"l10n_ch.ch_coa_2600","l10n_ch_account_tags.account_tag_ch_260" -"l10n_ch.ch_coa_2800","l10n_ch_account_tags.account_tag_ch_280" -"l10n_ch.ch_coa_2900","l10n_ch_account_tags.account_tag_ch_290" -"l10n_ch.ch_coa_2940","l10n_ch_account_tags.account_tag_ch_290" -"l10n_ch.ch_coa_2950","l10n_ch_account_tags.account_tag_ch_290" -"l10n_ch.ch_coa_2960","l10n_ch_account_tags.account_tag_ch_290" -"l10n_ch.ch_coa_2970","l10n_ch_account_tags.account_tag_ch_290" -"l10n_ch.ch_coa_2979","l10n_ch_account_tags.account_tag_ch_297" -"l10n_ch.ch_coa_2980","l10n_ch_account_tags.account_tag_ch_290" -"l10n_ch.ch_coa_3000","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3009","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3200","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3400","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3600","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3700","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3710","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3800","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3801","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3802","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3803","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3804","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3805","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3806","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3807","l10n_ch_account_tags.account_tag_ch_30" -"l10n_ch.ch_coa_3900","l10n_ch_account_tags.account_tag_ch_39" -"l10n_ch.ch_coa_3901","l10n_ch_account_tags.account_tag_ch_39" -"l10n_ch.ch_coa_3940","l10n_ch_account_tags.account_tag_ch_39" -"l10n_ch.ch_coa_4000","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4008","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4009","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4070","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4071","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4072","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4080","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4086","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4092","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4200","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4400","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4500","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4510","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4520","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4521","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4530","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4540","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4800","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4801","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4900","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4901","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4903","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_4906","l10n_ch_account_tags.account_tag_ch_4" -"l10n_ch.ch_coa_5000","l10n_ch_account_tags.account_tag_ch_5" -"l10n_ch.ch_coa_5700","l10n_ch_account_tags.account_tag_ch_5" -"l10n_ch.ch_coa_5800","l10n_ch_account_tags.account_tag_ch_5" -"l10n_ch.ch_coa_5900","l10n_ch_account_tags.account_tag_ch_5" -"l10n_ch.ch_coa_6000","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6100","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6105","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6200","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6260","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6300","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6400","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6500","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6570","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6600","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6700","l10n_ch_account_tags.account_tag_ch_60" -"l10n_ch.ch_coa_6800","l10n_ch_account_tags.account_tag_ch_68" -"l10n_ch.ch_coa_6900","l10n_ch_account_tags.account_tag_ch_69" -"l10n_ch.ch_coa_6950","l10n_ch_account_tags.account_tag_ch_69" -"l10n_ch.ch_coa_7000","l10n_ch_account_tags.account_tag_ch_7" -"l10n_ch.ch_coa_7010","l10n_ch_account_tags.account_tag_ch_7" -"l10n_ch.ch_coa_7500","l10n_ch_account_tags.account_tag_ch_7" -"l10n_ch.ch_coa_7510","l10n_ch_account_tags.account_tag_ch_7" -"l10n_ch.ch_coa_8000","l10n_ch_account_tags.account_tag_ch_80" -"l10n_ch.ch_coa_8100","l10n_ch_account_tags.account_tag_ch_80" -"l10n_ch.ch_coa_8500","l10n_ch_account_tags.account_tag_ch_85" -"l10n_ch.ch_coa_8510","l10n_ch_account_tags.account_tag_ch_85" -"l10n_ch.ch_coa_8900","l10n_ch_account_tags.account_tag_ch_89" diff --git a/l10n_ch_account_tags/data/update/account.account.template.csv b/l10n_ch_account_tags/data/update/account.account.template.csv deleted file mode 100644 index 0522bb49b..000000000 --- a/l10n_ch_account_tags/data/update/account.account.template.csv +++ /dev/null @@ -1,168 +0,0 @@ -id,tag_ids/id -l10n_ch.ch_coa_1060,account_tag_ch_106 -l10n_ch.ch_coa_1069,account_tag_ch_106 -l10n_ch.ch_coa_1091,account_tag_ch_106 -l10n_ch.ch_coa_1099,account_tag_ch_106 -l10n_ch.ch_coa_1100,account_tag_ch_110 -l10n_ch.ch_coa_1109,account_tag_ch_110 -l10n_ch.ch_coa_1140,account_tag_ch_114 -l10n_ch.ch_coa_1149,account_tag_ch_114 -l10n_ch.ch_coa_1170,account_tag_ch_114 -l10n_ch.ch_coa_1171,account_tag_ch_114 -l10n_ch.ch_coa_1176,account_tag_ch_114 -l10n_ch.ch_coa_1180,account_tag_ch_114 -l10n_ch.ch_coa_1189,account_tag_ch_114 -l10n_ch.ch_coa_1190,account_tag_ch_114 -l10n_ch.ch_coa_1199,account_tag_ch_114 -l10n_ch.ch_coa_1200,account_tag_ch_120 -l10n_ch.ch_coa_1207,account_tag_ch_120 -l10n_ch.ch_coa_1208,account_tag_ch_120 -l10n_ch.ch_coa_1209,account_tag_ch_120 -l10n_ch.ch_coa_1210,account_tag_ch_120 -l10n_ch.ch_coa_1217,account_tag_ch_120 -l10n_ch.ch_coa_1218,account_tag_ch_120 -l10n_ch.ch_coa_1219,account_tag_ch_120 -l10n_ch.ch_coa_1220,account_tag_ch_120 -l10n_ch.ch_coa_1230,account_tag_ch_120 -l10n_ch.ch_coa_1250,account_tag_ch_120 -l10n_ch.ch_coa_1260,account_tag_ch_120 -l10n_ch.ch_coa_1267,account_tag_ch_120 -l10n_ch.ch_coa_1269,account_tag_ch_120 -l10n_ch.ch_coa_1270,account_tag_ch_120 -l10n_ch.ch_coa_1277,account_tag_ch_120 -l10n_ch.ch_coa_1279,account_tag_ch_120 -l10n_ch.ch_coa_1280,account_tag_ch_120 -l10n_ch.ch_coa_1287,account_tag_ch_120 -l10n_ch.ch_coa_1289,account_tag_ch_120 -l10n_ch.ch_coa_1300,account_tag_ch_130 -l10n_ch.ch_coa_1301,account_tag_ch_130 -l10n_ch.ch_coa_1400,account_tag_ch_140 -l10n_ch.ch_coa_1409,account_tag_ch_140 -l10n_ch.ch_coa_1440,account_tag_ch_140 -l10n_ch.ch_coa_1441,account_tag_ch_140 -l10n_ch.ch_coa_1449,account_tag_ch_140 -l10n_ch.ch_coa_1480,account_tag_ch_148 -l10n_ch.ch_coa_1489,account_tag_ch_148 -l10n_ch.ch_coa_1500,account_tag_ch_150 -l10n_ch.ch_coa_1509,account_tag_ch_150 -l10n_ch.ch_coa_1510,account_tag_ch_150 -l10n_ch.ch_coa_1519,account_tag_ch_150 -l10n_ch.ch_coa_1520,account_tag_ch_150 -l10n_ch.ch_coa_1529,account_tag_ch_150 -l10n_ch.ch_coa_1530,account_tag_ch_150 -l10n_ch.ch_coa_1539,account_tag_ch_150 -l10n_ch.ch_coa_1540,account_tag_ch_150 -l10n_ch.ch_coa_1549,account_tag_ch_150 -l10n_ch.ch_coa_1550,account_tag_ch_150 -l10n_ch.ch_coa_1559,account_tag_ch_150 -l10n_ch.ch_coa_1570,account_tag_ch_150 -l10n_ch.ch_coa_1579,account_tag_ch_150 -l10n_ch.ch_coa_1590,account_tag_ch_150 -l10n_ch.ch_coa_1599,account_tag_ch_150 -l10n_ch.ch_coa_1600,account_tag_ch_160 -l10n_ch.ch_coa_1609,account_tag_ch_160 -l10n_ch.ch_coa_1700,account_tag_ch_170 -l10n_ch.ch_coa_1709,account_tag_ch_170 -l10n_ch.ch_coa_1770,account_tag_ch_170 -l10n_ch.ch_coa_1779,account_tag_ch_170 -l10n_ch.ch_coa_1850,account_tag_ch_180 -l10n_ch.ch_coa_2000,account_tag_ch_200 -l10n_ch.ch_coa_2030,account_tag_ch_200 -l10n_ch.ch_coa_2100,account_tag_ch_210 -l10n_ch.ch_coa_2120,account_tag_ch_210 -l10n_ch.ch_coa_2140,account_tag_ch_210 -l10n_ch.ch_coa_2160,account_tag_ch_210 -l10n_ch.ch_coa_2200,account_tag_ch_220 -l10n_ch.ch_coa_2201,account_tag_ch_220 -l10n_ch.ch_coa_2206,account_tag_ch_220 -l10n_ch.ch_coa_2208,account_tag_ch_220 -l10n_ch.ch_coa_2210,account_tag_ch_220 -l10n_ch.ch_coa_2261,account_tag_ch_220 -l10n_ch.ch_coa_2270,account_tag_ch_220 -l10n_ch.ch_coa_2279,account_tag_ch_220 -l10n_ch.ch_coa_2300,account_tag_ch_230 -l10n_ch.ch_coa_2301,account_tag_ch_230 -l10n_ch.ch_coa_2330,account_tag_ch_230 -l10n_ch.ch_coa_2400,account_tag_ch_240 -l10n_ch.ch_coa_2420,account_tag_ch_240 -l10n_ch.ch_coa_2430,account_tag_ch_240 -l10n_ch.ch_coa_2450,account_tag_ch_240 -l10n_ch.ch_coa_2451,account_tag_ch_240 -l10n_ch.ch_coa_2500,account_tag_ch_250 -l10n_ch.ch_coa_2600,account_tag_ch_260 -l10n_ch.ch_coa_2800,account_tag_ch_280 -l10n_ch.ch_coa_2900,account_tag_ch_290 -l10n_ch.ch_coa_2940,account_tag_ch_290 -l10n_ch.ch_coa_2950,account_tag_ch_290 -l10n_ch.ch_coa_2960,account_tag_ch_290 -l10n_ch.ch_coa_2970,account_tag_ch_290 -l10n_ch.ch_coa_2979,account_tag_ch_297 -l10n_ch.ch_coa_2980,account_tag_ch_290 -l10n_ch.ch_coa_3000,account_tag_ch_30 -l10n_ch.ch_coa_3009,account_tag_ch_30 -l10n_ch.ch_coa_3200,account_tag_ch_30 -l10n_ch.ch_coa_3400,account_tag_ch_30 -l10n_ch.ch_coa_3600,account_tag_ch_30 -l10n_ch.ch_coa_3700,account_tag_ch_30 -l10n_ch.ch_coa_3710,account_tag_ch_30 -l10n_ch.ch_coa_3800,account_tag_ch_30 -l10n_ch.ch_coa_3801,account_tag_ch_30 -l10n_ch.ch_coa_3802,account_tag_ch_30 -l10n_ch.ch_coa_3803,account_tag_ch_30 -l10n_ch.ch_coa_3804,account_tag_ch_30 -l10n_ch.ch_coa_3805,account_tag_ch_30 -l10n_ch.ch_coa_3806,account_tag_ch_30 -l10n_ch.ch_coa_3807,account_tag_ch_30 -l10n_ch.ch_coa_3900,account_tag_ch_39 -l10n_ch.ch_coa_3901,account_tag_ch_39 -l10n_ch.ch_coa_3940,account_tag_ch_39 -l10n_ch.ch_coa_4000,account_tag_ch_4 -l10n_ch.ch_coa_4008,account_tag_ch_4 -l10n_ch.ch_coa_4009,account_tag_ch_4 -l10n_ch.ch_coa_4070,account_tag_ch_4 -l10n_ch.ch_coa_4071,account_tag_ch_4 -l10n_ch.ch_coa_4072,account_tag_ch_4 -l10n_ch.ch_coa_4080,account_tag_ch_4 -l10n_ch.ch_coa_4086,account_tag_ch_4 -l10n_ch.ch_coa_4092,account_tag_ch_4 -l10n_ch.ch_coa_4200,account_tag_ch_4 -l10n_ch.ch_coa_4400,account_tag_ch_4 -l10n_ch.ch_coa_4500,account_tag_ch_4 -l10n_ch.ch_coa_4510,account_tag_ch_4 -l10n_ch.ch_coa_4520,account_tag_ch_4 -l10n_ch.ch_coa_4521,account_tag_ch_4 -l10n_ch.ch_coa_4530,account_tag_ch_4 -l10n_ch.ch_coa_4540,account_tag_ch_4 -l10n_ch.ch_coa_4800,account_tag_ch_4 -l10n_ch.ch_coa_4801,account_tag_ch_4 -l10n_ch.ch_coa_4900,account_tag_ch_4 -l10n_ch.ch_coa_4901,account_tag_ch_4 -l10n_ch.ch_coa_4903,account_tag_ch_4 -l10n_ch.ch_coa_4906,account_tag_ch_4 -l10n_ch.ch_coa_5000,account_tag_ch_5 -l10n_ch.ch_coa_5700,account_tag_ch_5 -l10n_ch.ch_coa_5800,account_tag_ch_5 -l10n_ch.ch_coa_5900,account_tag_ch_5 -l10n_ch.ch_coa_6000,account_tag_ch_60 -l10n_ch.ch_coa_6100,account_tag_ch_60 -l10n_ch.ch_coa_6105,account_tag_ch_60 -l10n_ch.ch_coa_6200,account_tag_ch_60 -l10n_ch.ch_coa_6260,account_tag_ch_60 -l10n_ch.ch_coa_6300,account_tag_ch_60 -l10n_ch.ch_coa_6400,account_tag_ch_60 -l10n_ch.ch_coa_6500,account_tag_ch_60 -l10n_ch.ch_coa_6570,account_tag_ch_60 -l10n_ch.ch_coa_6600,account_tag_ch_60 -l10n_ch.ch_coa_6700,account_tag_ch_60 -l10n_ch.ch_coa_6800,account_tag_ch_68 -l10n_ch.ch_coa_6900,account_tag_ch_69 -l10n_ch.ch_coa_6950,account_tag_ch_69 -l10n_ch.ch_coa_7000,account_tag_ch_7 -l10n_ch.ch_coa_7010,account_tag_ch_7 -l10n_ch.ch_coa_7500,account_tag_ch_7 -l10n_ch.ch_coa_7510,account_tag_ch_7 -l10n_ch.ch_coa_8000,account_tag_ch_80 -l10n_ch.ch_coa_8100,account_tag_ch_80 -l10n_ch.ch_coa_8500,account_tag_ch_85 -l10n_ch.ch_coa_8510,account_tag_ch_85 -l10n_ch.ch_coa_8900,account_tag_ch_89 diff --git a/l10n_ch_account_tags/hooks.py b/l10n_ch_account_tags/hooks.py new file mode 100644 index 000000000..de64b5f38 --- /dev/null +++ b/l10n_ch_account_tags/hooks.py @@ -0,0 +1,234 @@ +import logging + +_logger = logging.getLogger(__name__) + + +def assign_account_tags(env): + """Assign tags to specific accounts.""" + # List of account codes and the corresponding tags to assign + account_tags = { + "transfer_account_id": "l10n_ch_account_tags.account_tag_ch_106", + "ch_coa_1060": "l10n_ch_account_tags.account_tag_ch_106", + "ch_coa_1069": "l10n_ch_account_tags.account_tag_ch_106", + "ch_coa_1091": "l10n_ch_account_tags.account_tag_ch_106", + "ch_coa_1099": "l10n_ch_account_tags.account_tag_ch_106", + "ch_coa_1100": "l10n_ch_account_tags.account_tag_ch_110", + "ch_coa_1109": "l10n_ch_account_tags.account_tag_ch_110", + "ch_coa_1140": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1149": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1170": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1171": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1176": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1180": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1189": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1190": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1199": "l10n_ch_account_tags.account_tag_ch_114", + "ch_coa_1200": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1207": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1208": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1209": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1210": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1217": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1218": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1219": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1220": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1230": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1250": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1260": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1267": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1269": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1270": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1277": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1279": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1280": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1287": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1289": "l10n_ch_account_tags.account_tag_ch_120", + "ch_coa_1300": "l10n_ch_account_tags.account_tag_ch_130", + "ch_coa_1301": "l10n_ch_account_tags.account_tag_ch_130", + "ch_coa_1400": "l10n_ch_account_tags.account_tag_ch_140", + "ch_coa_1409": "l10n_ch_account_tags.account_tag_ch_140", + "ch_coa_1440": "l10n_ch_account_tags.account_tag_ch_140", + "ch_coa_1441": "l10n_ch_account_tags.account_tag_ch_140", + "ch_coa_1449": "l10n_ch_account_tags.account_tag_ch_140", + "ch_coa_1480": "l10n_ch_account_tags.account_tag_ch_148", + "ch_coa_1489": "l10n_ch_account_tags.account_tag_ch_148", + "ch_coa_1500": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1509": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1510": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1519": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1520": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1529": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1530": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1539": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1540": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1549": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1550": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1559": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1570": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1579": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1590": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1599": "l10n_ch_account_tags.account_tag_ch_150", + "ch_coa_1600": "l10n_ch_account_tags.account_tag_ch_160", + "ch_coa_1609": "l10n_ch_account_tags.account_tag_ch_160", + "ch_coa_1700": "l10n_ch_account_tags.account_tag_ch_170", + "ch_coa_1709": "l10n_ch_account_tags.account_tag_ch_170", + "ch_coa_1770": "l10n_ch_account_tags.account_tag_ch_170", + "ch_coa_1779": "l10n_ch_account_tags.account_tag_ch_170", + "ch_coa_1850": "l10n_ch_account_tags.account_tag_ch_180", + "ch_coa_2000": "l10n_ch_account_tags.account_tag_ch_200", + "ch_coa_2030": "l10n_ch_account_tags.account_tag_ch_200", + "ch_coa_2100": "l10n_ch_account_tags.account_tag_ch_210", + "ch_coa_2120": "l10n_ch_account_tags.account_tag_ch_210", + "ch_coa_2140": "l10n_ch_account_tags.account_tag_ch_210", + "ch_coa_2160": "l10n_ch_account_tags.account_tag_ch_210", + "ch_coa_2200": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2201": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2206": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2208": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2210": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2261": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2270": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2279": "l10n_ch_account_tags.account_tag_ch_220", + "ch_coa_2300": "l10n_ch_account_tags.account_tag_ch_230", + "ch_coa_2301": "l10n_ch_account_tags.account_tag_ch_230", + "ch_coa_2330": "l10n_ch_account_tags.account_tag_ch_230", + "ch_coa_2400": "l10n_ch_account_tags.account_tag_ch_240", + "ch_coa_2420": "l10n_ch_account_tags.account_tag_ch_240", + "ch_coa_2430": "l10n_ch_account_tags.account_tag_ch_240", + "ch_coa_2450": "l10n_ch_account_tags.account_tag_ch_240", + "ch_coa_2451": "l10n_ch_account_tags.account_tag_ch_240", + "ch_coa_2500": "l10n_ch_account_tags.account_tag_ch_250", + "ch_coa_2600": "l10n_ch_account_tags.account_tag_ch_260", + "ch_coa_2800": "l10n_ch_account_tags.account_tag_ch_280", + "ch_coa_2900": "l10n_ch_account_tags.account_tag_ch_290", + "ch_coa_2940": "l10n_ch_account_tags.account_tag_ch_290", + "ch_coa_2950": "l10n_ch_account_tags.account_tag_ch_290", + "ch_coa_2960": "l10n_ch_account_tags.account_tag_ch_290", + "ch_coa_2970": "l10n_ch_account_tags.account_tag_ch_290", + "ch_coa_2979": "l10n_ch_account_tags.account_tag_ch_297", + "ch_coa_2980": "l10n_ch_account_tags.account_tag_ch_290", + "ch_coa_3000": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3009": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3200": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3400": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3600": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3700": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3710": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3800": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3801": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3802": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3803": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3804": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3805": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3806": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3807": "l10n_ch_account_tags.account_tag_ch_30", + "ch_coa_3900": "l10n_ch_account_tags.account_tag_ch_39", + "ch_coa_3901": "l10n_ch_account_tags.account_tag_ch_39", + "ch_coa_3940": "l10n_ch_account_tags.account_tag_ch_39", + "ch_coa_4000": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4008": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4009": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4070": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4071": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4072": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4080": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4086": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4092": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4200": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4400": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4500": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4510": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4520": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4521": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4530": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4540": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4800": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4801": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4900": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4901": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4903": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_4906": "l10n_ch_account_tags.account_tag_ch_4", + "ch_coa_5000": "l10n_ch_account_tags.account_tag_ch_5", + "ch_coa_5700": "l10n_ch_account_tags.account_tag_ch_5", + "ch_coa_5800": "l10n_ch_account_tags.account_tag_ch_5", + "ch_coa_5900": "l10n_ch_account_tags.account_tag_ch_5", + "ch_coa_6000": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6100": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6105": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6200": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6260": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6300": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6400": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6500": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6570": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6600": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6700": "l10n_ch_account_tags.account_tag_ch_60", + "ch_coa_6800": "l10n_ch_account_tags.account_tag_ch_68", + "ch_coa_6900": "l10n_ch_account_tags.account_tag_ch_69", + "ch_coa_6950": "l10n_ch_account_tags.account_tag_ch_69", + "ch_coa_7000": "l10n_ch_account_tags.account_tag_ch_7", + "ch_coa_7010": "l10n_ch_account_tags.account_tag_ch_7", + "ch_coa_7500": "l10n_ch_account_tags.account_tag_ch_7", + "ch_coa_7510": "l10n_ch_account_tags.account_tag_ch_7", + "ch_coa_8000": "l10n_ch_account_tags.account_tag_ch_80", + "ch_coa_8100": "l10n_ch_account_tags.account_tag_ch_80", + "ch_coa_8500": "l10n_ch_account_tags.account_tag_ch_85", + "ch_coa_8510": "l10n_ch_account_tags.account_tag_ch_85", + "ch_coa_8900": "l10n_ch_account_tags.account_tag_ch_89", + } + + # Search for companies with chart template 'ch' + companies = env["res.company"].search([("chart_template", "=", "ch")]) + + # Create a dictionary to hold account IDs and their corresponding tags + account_tag_mapping = {} + + # Loop through the companies and account_tags to group account-tag pairs + for company in companies: + for account_code, tag_code in account_tags.items(): + # Construct the xml_id of the account based on company ID and account code + xml_id = f"account.{company.id}_{account_code}" + + try: + # Use env.ref() to search for the account by xml_id + account = env.ref(xml_id) + + # Use env.ref() to search for the tag by tag_code + tag = env.ref(tag_code) + + if account and tag: + # If the account is found, group the tags by account_id + if account.id not in account_tag_mapping: + account_tag_mapping[account.id] = [] + + account_tag_mapping[account.id].append(tag.id) + else: + if not account: + _logger.warning(f"Account with xml_id {xml_id} not found.") + if not tag: + _logger.warning(f"Tag with code {tag_code} not found.") + + except (ValueError, KeyError, AttributeError) as e: + _logger.error( + f"Error processing account {xml_id} and tag {tag_code}: " + f"{str(e)}" + ) + + # Perform bulk updates for each account by adding new tags + for account_id, tag_ids in account_tag_mapping.items(): + account = env["account.account"].browse(account_id) + + if account: + # Get the IDs of existing tags assigned to the account + existing_tags = account.tag_ids.ids + + # Filter out the tags that are already assigned + new_tags = list(set(tag_ids) - set(existing_tags)) + + if new_tags: + # Add the new tags to the account + account.tag_ids = [(4, tag_id) for tag_id in new_tags] + + +def post_init(env): + assign_account_tags(env) diff --git a/l10n_ch_account_tags/readme/CONTRIBUTORS.md b/l10n_ch_account_tags/readme/CONTRIBUTORS.md index 855219a76..ac253ceb9 100644 --- a/l10n_ch_account_tags/readme/CONTRIBUTORS.md +++ b/l10n_ch_account_tags/readme/CONTRIBUTORS.md @@ -5,3 +5,4 @@ - [Trobz](https://trobz.com): > - Son Ho \<\> + > - Khoi (Kien Kim) \<\> diff --git a/l10n_ch_account_tags/readme/CREDITS.md b/l10n_ch_account_tags/readme/CREDITS.md index 4351fe296..924bc05d8 100644 --- a/l10n_ch_account_tags/readme/CREDITS.md +++ b/l10n_ch_account_tags/readme/CREDITS.md @@ -1,2 +1,5 @@ The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp + +The migration of this module from 16.0 to 18.0 was financially supported by: +- Camptocamp diff --git a/l10n_ch_account_tags/static/description/index.html b/l10n_ch_account_tags/static/description/index.html index 4f1437ad9..64149b0ca 100644 --- a/l10n_ch_account_tags/static/description/index.html +++ b/l10n_ch_account_tags/static/description/index.html @@ -1,4 +1,3 @@ -