From fca36e061a3e71e5a80523fbf0c2019de501fdd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 15 Feb 2014 18:37:07 +0100 Subject: [PATCH] New tax rates for 2014 issue3596 review3341002 --- CHANGELOG | 2 + __init__.py | 10 ++ account.py | 70 +++++++++ tax_fr.xml | 402 +++++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 430 insertions(+), 54 deletions(-) create mode 100644 account.py diff --git a/CHANGELOG b/CHANGELOG index a162b660c0..b1b6a2eab0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* New tax rates for 2014 + Version 3.0.0 - 2013-10-21 * Bug fixes (see mercurial logs for details) diff --git a/__init__.py b/__init__.py index c86640b67f..0d2f89a3da 100644 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,12 @@ #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') diff --git a/account.py b/account.py new file mode 100644 index 0000000000..cd6597fe55 --- /dev/null +++ b/account.py @@ -0,0 +1,70 @@ +#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) diff --git a/tax_fr.xml b/tax_fr.xml index 634bedf48d..64b3edf755 100644 --- a/tax_fr.xml +++ b/tax_fr.xml @@ -83,6 +83,13 @@ this repository contains the full copyright notices and license terms. --> + + Taux normal 20% + 0207 + + + + Taux réduit 5,5% 0105 @@ -97,6 +104,13 @@ this repository contains the full copyright notices and license terms. --> + + Taux réduit 10% + 0151 + + + + Taux normal 8,5% 0201 @@ -187,6 +201,13 @@ this repository contains the full copyright notices and license terms. --> + + Taux normal 20% + 0207 + + + + Taux réduit 5,5% 0105 @@ -201,6 +222,13 @@ this repository contains the full copyright notices and license terms. --> + + Taux réduit 10% + 0151 + + + + Taux normal 8,5% 0201 @@ -560,10 +588,46 @@ this repository contains the full copyright notices and license terms. --> purchase + + T.V.A. Vente Taux Normal + T.V.A. Taux Normal + + + none + + + + + + + + + + + + + T.V.A. Vente 20% + T.V.A. 20% + + 2014-01-01 + + percentage + + + + + + + + + + + T.V.A. Vente 19,6% T.V.A. 19,6% - + + 2013-12-31 percentage @@ -577,6 +641,59 @@ this repository contains the full copyright notices and license terms. --> + + T.V.A. Vente Taux Intermédiaire + T.V.A. Taux Intermédiaire + + + none + + + + + + + + + + + + + T.V.A. Vente 10% + T.V.A. 10% + + 2014-01-01 + + percentage + + + + + + + + + + + + + T.V.A. Vente 7% + T.V.A. 7% + + 2013-12-31 + + percentage + + + + + + + + + + + T.V.A. Vente 8,5% T.V.A. 8,5% @@ -594,23 +711,6 @@ this repository contains the full copyright notices and license terms. --> - - T.V.A. Vente 7% - T.V.A. 7% - - - percentage - - - - - - - - - - - T.V.A. Vente 5,5% T.V.A. 5,5% @@ -645,10 +745,43 @@ this repository contains the full copyright notices and license terms. --> + + T.V.A. Vente Intracommunautaire Taux Normal + T.V.A. Taux Normal + + + none + + + + + + + + + + + + + T.V.A. Vente Intracommunautaire 20% + T.V.A. 20% + + 2014-01-01 + + percentage + + + + + + + + T.V.A. Vente Intracommunautaire 19,6% T.V.A. 19,6% - + + 2013-12-31 percentage @@ -659,6 +792,56 @@ this repository contains the full copyright notices and license terms. --> + + T.V.A. Vente Intracommunautaire Taux Intermédiaire + T.V.A. Taux Intermédiaire + + + none + + + + + + + + + + + + + T.V.A. Vente Intracommunautaire 10% + T.V.A. 10% + + 2014-01-01 + + percentage + + + + + + + + + + T.V.A. Vente Intracommunautaire 7% + T.V.A. 7% + + 2013-12-31 + + percentage + + + + + + + + T.V.A. Vente Intracommunautaire 8,5% T.V.A. 8,5% @@ -673,20 +856,6 @@ this repository contains the full copyright notices and license terms. --> - - T.V.A. Vente Intracommunautaire 7% - T.V.A. 7% - - - percentage - - - - - - - - T.V.A. Vente Intracommunautaire 5,5% T.V.A. 5,5% @@ -729,10 +898,43 @@ this repository contains the full copyright notices and license terms. --> + + T.V.A. Achat Taux Normal + T.V.A. Taux Normal + + + none + + + + + + + + + + + + + T.V.A. Achat 20% + T.V.A. 20% + + 2014-01-01 + + percentage + + + + + + + + T.V.A. Achat 19,6% T.V.A. 19,6% - + + 2013-12-31 percentage @@ -743,6 +945,53 @@ this repository contains the full copyright notices and license terms. --> + + T.V.A. Achat Taux Intermédiaire + T.V.A. Taux Intermédiaire + + + none + + + + + + + + + + + + + T.V.A. Achat 10% + T.V.A. 10% + + 2014-01-01 + + percentage + + + + + + + + + + T.V.A. Achat 7% + T.V.A. 7% + + 2013-12-31 + + percentage + + + + + + + + T.V.A. Achat 8,5% T.V.A. 8,5% @@ -757,20 +1006,6 @@ this repository contains the full copyright notices and license terms. --> - - T.V.A. Achat 7% - T.V.A. 7% - - - percentage - - - - - - - - T.V.A. Achat 5,5% T.V.A. 5,5% @@ -799,9 +1034,68 @@ this repository contains the full copyright notices and license terms. --> + + T.V.A. Achat Intracommunautaire Taux Normal + T.V.A. Taux Normal + + + none + + + + + + + + + + + + + T.V.A. Achat Intracommunautaire 20% + T.V.A. 20% + + 2014-01-01 + + none + + + + T.V.A. Achat Intracommunautaire 20% (1) + T.V.A. 20% + + + percentage + + + + + + + + + + + + T.V.A. Achat Intracommunautaire 20% (2) + T.V.A. 20% + + + percentage + + + + + T.V.A. Achat Intracommunautaire 19,6% T.V.A. 19,6% + + 2013-12-31 none @@ -922,11 +1216,11 @@ this repository contains the full copyright notices and license terms. --> + id="tax_rule_ventes_intracommunautaires_taux_normal"> - - + + @@ -936,11 +1230,11 @@ this repository contains the full copyright notices and license terms. --> + id="tax_rule_ventes_intracommunautaires_taux_intermediaire"> - - + +