changeset 89e7d17d4865 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset;node=89e7d17d4865
description:
Add active on tax template
With the ondelete RESTRICT, this will allow to deactivate the taxes,
which
were removed from the template, when the chart of account is updated.
issue7718
review54441002
diffstat:
tax.py | 7 ++++---
view/tax_template_form.xml | 5 +++++
2 files changed, 9 insertions(+), 3 deletions(-)
diffs (48 lines):
diff -r 382e1676d181 -r 89e7d17d4865 tax.py
--- a/tax.py Mon Dec 03 11:38:03 2018 +0100
+++ b/tax.py Mon Dec 17 23:04:56 2018 +0100
@@ -471,7 +471,7 @@
return 'end'
-class TaxTemplate(sequence_ordered(), ModelSQL, ModelView):
+class TaxTemplate(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
'Account Tax Template'
__name__ = 'account.tax.template'
name = fields.Char('Name', required=True)
@@ -546,7 +546,7 @@
res = {}
for field in ['name', 'description', 'sequence', 'amount', 'rate',
'type', 'start_date', 'end_date', 'update_unit_price',
- 'legal_notice']:
+ 'legal_notice', 'active']:
if not tax or getattr(tax, field) != getattr(self, field):
res[field] = getattr(self, field)
for field in ('group',):
@@ -699,7 +699,8 @@
depends=['company', 'type'])
legal_notice = fields.Text("Legal Notice", translate=True,
states=_states)
- template = fields.Many2One('account.tax.template', 'Template')
+ template = fields.Many2One('account.tax.template', 'Template',
+ ondelete='RESTRICT')
template_override = fields.Boolean('Override Template',
help="Check to override template definition",
states={
diff -r 382e1676d181 -r 89e7d17d4865 view/tax_template_form.xml
--- a/view/tax_template_form.xml Mon Dec 03 11:38:03 2018 +0100
+++ b/view/tax_template_form.xml Mon Dec 17 23:04:56 2018 +0100
@@ -4,8 +4,13 @@
<form>
<label name="name"/>
<field name="name"/>
+ <group col="-1" colspan="2" id="checkboxes">
+ <label name="active"/>
+ <field name="active" xexpand="0" width="100"/>
+ </group>
<label name="account"/>
<field name="account"/>
+ <newline/>
<label name="description"/>
<field name="description" colspan="3"/>
<notebook colspan="4">