[FIX] account, l10n_*: preserve existing tags on upgrade

Taxes tags for some localization have been rewrote in order to improve the taxes report.
However, these changes delete the existing account.tags on stable version.

These "[l10n_*] one tag per grid in tax reports" should target master instead of 9.0.

-opw: 777464
This commit is contained in:
Laurent Smet
2017-10-27 13:54:31 +02:00
parent e47e78e2e9
commit c44024b50b
15 changed files with 48 additions and 0 deletions
+6
View File
@@ -36,6 +36,12 @@ def migrate_tags_on_taxes(cr, registry):
if len(tax_id) == 1:
registry['account.tax'].write(cr, SUPERUSER_ID, tax_id, {'tag_ids': [(6,0,[x.id for x in tax_template.tag_ids])]})
def preserve_existing_tags_on_taxes(cr, registry, module):
''' This is a utility function used to preserve existing previous tags during upgrade of the module.'''
xml_record_ids = registry['ir.model.data'].search(cr, SUPERUSER_ID, [('model', 'in', ['account.account.tag']), ('module', 'like', module)])
if xml_record_ids:
cr.execute("update ir_model_data set noupdate = 't' where id in %s", (tuple(xml_record_ids),))
# ---------------------------------------------------------------
# Account Templates: Account, Tax, Tax Code and chart. + Wizard
# ---------------------------------------------------------------
+5
View File
@@ -4,3 +4,8 @@
# Copyright (c) 2008 JAILLET Simon - CrysaLEAD - www.crysalead.fr
import l10n_fr
def _preserve_tag_on_taxes(cr, registry):
from openerp.addons.account.models.chart_template import preserve_existing_tags_on_taxes
preserve_existing_tags_on_taxes(cr, registry, 'l10n_fr')
+1
View File
@@ -41,4 +41,5 @@ configuration of their taxes and fiscal positions manually.
'demo': [],
'auto_install': False,
'installable': True,
'post_init_hook': '_preserve_tag_on_taxes',
}
+5
View File
@@ -1,2 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
def _preserve_tag_on_taxes(cr, registry):
from openerp.addons.account.models.chart_template import preserve_existing_tags_on_taxes
preserve_existing_tags_on_taxes(cr, registry, 'l10n_lu')
+1
View File
@@ -43,4 +43,5 @@ Notes:
'demo': [],
'installable': True,
'auto_install': False,
'post_init_hook': '_preserve_tag_on_taxes',
}
+5
View File
@@ -1,2 +1,7 @@
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
def _preserve_tag_on_taxes(cr, registry):
from openerp.addons.account.models.chart_template import preserve_existing_tags_on_taxes
preserve_existing_tags_on_taxes(cr, registry, 'l10n_no')
+1
View File
@@ -16,4 +16,5 @@ Updated for Odoo 9 by Bringsvor Consulting AS <www.bringsvor.com>
'account_tax.xml','account_chart_template.yml'],
"active": False,
"installable": True
'post_init_hook': '_preserve_tag_on_taxes',
}
+5
View File
@@ -1,2 +1,7 @@
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
def _preserve_tag_on_taxes(cr, registry):
from openerp.addons.account.models.chart_template import preserve_existing_tags_on_taxes
preserve_existing_tags_on_taxes(cr, registry, 'l10n_pl')
+1
View File
@@ -30,4 +30,5 @@ Wewnętrzny numer wersji OpenGLOBE 1.02
'account_chart_template.yml'
],
'installable': True,
'post_init_hook': '_preserve_tag_on_taxes',
}
+5
View File
@@ -2,3 +2,8 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2014 Tech Receptives (<http://techreceptives.com>).
def _preserve_tag_on_taxes(cr, registry):
from openerp.addons.account.models.chart_template import preserve_existing_tags_on_taxes
preserve_existing_tags_on_taxes(cr, registry, 'l10n_sg')
+1
View File
@@ -34,4 +34,5 @@ After installing this module, the Configuration wizard for accounting is launche
'account_chart_template.yml',
],
'installable': True,
'post_init_hook': '_preserve_tag_on_taxes',
}
+5
View File
@@ -1,2 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
def _preserve_tag_on_taxes(cr, registry):
from openerp.addons.account.models.chart_template import preserve_existing_tags_on_taxes
preserve_existing_tags_on_taxes(cr, registry, 'l10n_th')
+1
View File
@@ -19,4 +19,5 @@ Thai accounting chart and localization.
'account_chart_template.yml',
],
'installable': True,
'post_init_hook': '_preserve_tag_on_taxes',
}
+5
View File
@@ -2,3 +2,8 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# This module is Copyright (c) 2009-2013 General Solutions (http://gscom.vn) All Rights Reserved.
def _preserve_tag_on_taxes(cr, registry):
from openerp.addons.account.models.chart_template import preserve_existing_tags_on_taxes
preserve_existing_tags_on_taxes(cr, registry, 'l10n_vn')
+1
View File
@@ -21,4 +21,5 @@ This module applies to companies based in Vietnamese Accounting Standard (VAS).
"data" : ["account_chart.xml","account_tax.xml","account_chart_template.yml"],
"demo" : [],
"installable": True,
'post_init_hook': '_preserve_tag_on_taxes',
}