Skip to content
Snippets Groups Projects
Commit 58c224a2 authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

New tax rates for 2014

issue3596
review3341002
parent 4f886bc5
No related branches found
No related tags found
No related merge requests found
* New tax rates for 2014
Version 3.0.0 - 2013-10-21
* Bug fixes (see mercurial logs for details)
......
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from account import *
def register():
Pool.register(
TaxTemplate,
TaxRuleTemplate,
module='account_fr', type_='model')
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from sql import Table
from trytond.pool import PoolMeta
from trytond.transaction import Transaction
__all__ = ['TaxTemplate', 'TaxRuleTemplate']
__metaclass__ = PoolMeta
class TaxTemplate:
__name__ = 'account.tax.template'
@classmethod
def __register__(cls, module_name):
cursor = Transaction().cursor
model_data = Table('ir_model_data')
# Migration from 3.0: new tax rates
if module_name == 'account_fr':
for old_id, new_id in (
('tva_vente_19_6', 'tva_vente_taux_normal'),
('tva_vente_7', 'tva_vente_taux_intermediaire'),
('tva_vente_intracommunautaire_19_6',
'tva_vente_intracommunautaire_taux_normal'),
('tva_vente_intracommunautaire_7',
'tva_vente_intracommunautaire_taux_intermediaire'),
('tva_achat_19_6', 'tva_achat_taux_normal'),
('tva_achat_7', 'tva_achat_taux_intermediaire'),
('tva_achat_intracommunautaire_19_6',
'tva_achat_intracommunautaire_taux_normal'),
):
cursor.execute(*model_data.select(model_data.id,
where=(model_data.fs_id == new_id)
& (model_data.module == module_name)))
if cursor.fetchone():
continue
cursor.execute(*model_data.update(
columns=[model_data.fs_id],
values=[new_id],
where=(model_data.fs_id == old_id)
& (model_data.module == module_name)))
super(TaxTemplate, cls).__register__(module_name)
class TaxRuleTemplate:
__name__ = 'account.tax.rule.template'
@classmethod
def __register__(cls, module_name):
cursor = Transaction().cursor
model_data = Table('ir_model_data')
if module_name == 'account_fr':
for old_id, new_id in (
('tax_rule_ventes_intracommunautaires_19_6',
'tax_rule_ventes_intracommunautaires_taux_normal'),
('tax_rule_ventes_intracommunautaires_7',
'tax_rule_ventes_intracommunautaires_taux_intermediaire'),
):
cursor.execute(*model_data.update(
columns=[model_data.fs_id],
values=[new_id],
where=(model_data.fs_id == old_id)
& (model_data.module == module_name)))
super(TaxRuleTemplate, cls).__register__(module_name)
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment