Move tax_rounding from account_invoice module to account module
Remove redundant files and code from account_invoice module issue5363 review20871002
This commit is contained in:
1 parent
b455cda23e
commit
5a0588bfa7
7 files changed
+4
-132
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ def register():
|
||||
Period,
|
||||
Move,
|
||||
Reconciliation,
|
||||
Configuration,
|
||||
ConfigurationTaxRounding,
|
||||
module='account_invoice', type_='model')
|
||||
Pool.register(
|
||||
TestPaymentTerm,
|
||||
|
||||
+3
-62
@@ -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:
|
||||
|
||||
-36
@@ -3,42 +3,6 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="configuration_view_form">
|
||||
<field name="model">account.configuration</field>
|
||||
<field name="inherit" ref="account.configuration_view_form"/>
|
||||
<field name="name">configuration_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="configuration_tax_rounding_view_form">
|
||||
<field name="model">account.configuration.tax_rounding</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">configuration_tax_rounding_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="configuration_tax_rounding_view_list">
|
||||
<field name="model">account.configuration.tax_rounding</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">configuration_tax_rounding_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.access" id="access_configuration_tax_rounding">
|
||||
<field name="model"
|
||||
search="[('model', '=', 'account.configuration.tax_rounding')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="False"/>
|
||||
<field name="perm_create" eval="False"/>
|
||||
<field name="perm_delete" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.model.access"
|
||||
id="access_configuration_tax_rounding_account_admin">
|
||||
<field name="model"
|
||||
search="[('model', '=', 'account.configuration.tax_rounding')]"/>
|
||||
<field name="group" ref="account.group_account_admin"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="fiscalyear_view_form">
|
||||
<field name="model">account.fiscalyear</field>
|
||||
<field name="inherit" ref="account.fiscalyear_view_form"/>
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/form" position="inside">
|
||||
<separator id="invoice" string="Invoice" colspan="4"/>
|
||||
<label name="tax_rounding"/>
|
||||
<field name="tax_rounding"/>
|
||||
<field name="tax_roundings" colspan="2" yexpand="0"/>
|
||||
</xpath>
|
||||
</data>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form string="Account Configuration Tax Rounding" cursor="company">
|
||||
<label name="configuration"/>
|
||||
<field name="configuration"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<label name="method"/>
|
||||
<field name="method"/>
|
||||
</form>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Account Configuration Tax Roundings" sequence="sequence">
|
||||
<field name="configuration"/>
|
||||
<field name="company"/>
|
||||
<field name="method" expand="1"/>
|
||||
</tree>
|
||||
Reference in new issue
Block a user