diff --git a/addons/l10n_vn/__manifest__.py b/addons/l10n_vn/__manifest__.py index 6004735228f..c3ddb5aa91a 100644 --- a/addons/l10n_vn/__manifest__.py +++ b/addons/l10n_vn/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Vietnam - Accounting", - "version": "2.0", + "version": "2.0.1", "author": "General Solutions", 'website': 'http://gscom.vn', 'category': 'Accounting/Localizations/Account Charts', diff --git a/addons/l10n_vn/data/account.account.template.csv b/addons/l10n_vn/data/account.account.template.csv index 34b17e12d7a..a412f97705a 100644 --- a/addons/l10n_vn/data/account.account.template.csv +++ b/addons/l10n_vn/data/account.account.template.csv @@ -147,9 +147,9 @@ "chart5117","Revenue from investment properties",5117,"account.data_account_type_revenue","vn_template","False" "chart5118","Other revenue",5118,"account.data_account_type_revenue","vn_template","False" "chart515","Financial income",515,"account.data_account_type_revenue","vn_template","False" -"chart5221","Trade discounts",5221,"account.data_account_type_revenue","vn_template","False" -"chart5222","Sales returns",5222,"account.data_account_type_revenue","vn_template","False" -"chart5223","Sales rebates",5223,"account.data_account_type_revenue","vn_template","False" +"chart5211","Trade discounts",5211,"account.data_account_type_revenue","vn_template","False" +"chart5212","Sales returns",5212,"account.data_account_type_revenue","vn_template","False" +"chart5213","Sales rebates",5213,"account.data_account_type_revenue","vn_template","False" "chart6111","Purchases of raw materials",6111,"account.data_account_type_direct_costs","vn_template","False" "chart621","Direct raw material costs",621,"account.data_account_type_direct_costs","vn_template","False" "chart622","Direct labour costs",622,"account.data_account_type_direct_costs","vn_template","False" diff --git a/addons/l10n_vn/migrations/14.0.2.0.1/post-migration.py b/addons/l10n_vn/migrations/14.0.2.0.1/post-migration.py new file mode 100644 index 00000000000..5033b0372b3 --- /dev/null +++ b/addons/l10n_vn/migrations/14.0.2.0.1/post-migration.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from odoo import api, SUPERUSER_ID + +FIXED_ACCOUNTS_MAP = { + '5221': '5211', + '5222': '5212', + '5223': '5213' + } + + +def _fix_revenue_deduction_accounts_code(env): + vn_template = env.ref('l10n_vn.vn_template') + for company in env['res.company'].with_context(active_test=False).search([('chart_template_id', '=', vn_template.id)]): + for incorrect_code, correct_code in FIXED_ACCOUNTS_MAP.items(): + account = env['account.account'].search([('code', '=', incorrect_code), ('company_id', '=', company.id)]) + if account: + account.write({'code': correct_code}) + + +def migrate(cr, version): + env = api.Environment(cr, SUPERUSER_ID, {}) + _fix_revenue_deduction_accounts_code(env)