[FIX] l10n_vn: wrong account code for the revenue deduction accounts
closes odoo/odoo#75042 X-original-commit: bfe7190215c3014df2fb468f1860b24759de2e38 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
@@ -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)
|
||||
Reference in New Issue
Block a user