diff --git a/CHANGELOG b/CHANGELOG index 830f99e499..30820e0846 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ * Merge invoice and credit note * Inversed sign of tax report from credit note +* Move tax Rounding configuration to account * Add Python3 support * Change payment term percentage into ratio diff --git a/__init__.py b/__init__.py index aa65f3a9c0..9071fa1aec 100644 --- a/__init__.py +++ b/__init__.py @@ -30,8 +30,6 @@ def register(): Period, Move, Reconciliation, - Configuration, - ConfigurationTaxRounding, module='account_invoice', type_='model') Pool.register( TestPaymentTerm, diff --git a/account.py b/account.py index 995e03c9d6..610530eb31 100644 --- a/account.py +++ b/account.py @@ -1,70 +1,11 @@ # 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 Null -from sql.conditionals import Case - -from trytond.model import ModelSQL, ModelView, MatchMixin, fields +from trytond.model import fields from trytond.pyson import Eval from trytond.pool import Pool, PoolMeta -from trytond.transaction import Transaction -__all__ = ['Configuration', 'ConfigurationTaxRounding', - 'FiscalYear', 'Period', 'Move', 'Reconciliation'] - -tax_roundings = [ - ('document', 'Per Document'), - ('line', 'Per Line'), - ] - - -class Configuration: - __metaclass__ = PoolMeta - __name__ = 'account.configuration' - tax_rounding = fields.Function(fields.Selection(tax_roundings, - 'Tax Rounding'), 'on_change_with_tax_rounding') - tax_roundings = fields.One2Many('account.configuration.tax_rounding', - 'configuration', 'Tax Roundings') - - @staticmethod - def default_tax_rounding(): - return 'document' - - @fields.depends('tax_roundings') - def on_change_with_tax_rounding(self, name=None, pattern=None): - context = Transaction().context - if pattern is None: - pattern = {} - pattern = pattern.copy() - pattern['company'] = context.get('company') - - for line in self.tax_roundings: - if line.match(pattern): - return line.method - return self.default_tax_rounding() - - -class ConfigurationTaxRounding(ModelSQL, ModelView, MatchMixin): - 'Account Configuration Tax Rounding' - __name__ = 'account.configuration.tax_rounding' - configuration = fields.Many2One('account.configuration', 'Configuration', - required=True, ondelete='CASCADE') - sequence = fields.Integer('Sequence') - company = fields.Many2One('company.company', 'Company') - method = fields.Selection(tax_roundings, 'Method', required=True) - - @classmethod - def __setup__(cls): - super(ConfigurationTaxRounding, cls).__setup__() - cls._order.insert(0, ('sequence', 'ASC')) - - @staticmethod - def order_sequence(tables): - table, _ = tables[None] - return [Case((table.sequence == Null, 0), else_=1), table.sequence] - - @staticmethod - def default_method(): - return 'document' +__all__ = ['FiscalYear', + 'Period', 'Move', 'Reconciliation'] class FiscalYear: diff --git a/account.xml b/account.xml index 3937f8fc96..fda39f504e 100644 --- a/account.xml +++ b/account.xml @@ -3,42 +3,6 @@ this repository contains the full copyright notices and license terms. --> - - account.configuration - - configuration_form - - - - account.configuration.tax_rounding - form - configuration_tax_rounding_form - - - account.configuration.tax_rounding - tree - configuration_tax_rounding_list - - - - - - - - - - - - - - - - - - account.fiscalyear diff --git a/view/configuration_form.xml b/view/configuration_form.xml deleted file mode 100644 index 3150a0dbd1..0000000000 --- a/view/configuration_form.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/view/configuration_tax_rounding_form.xml b/view/configuration_tax_rounding_form.xml deleted file mode 100644 index 92cac9c7cf..0000000000 --- a/view/configuration_tax_rounding_form.xml +++ /dev/null @@ -1,13 +0,0 @@ - - -
-