Make PYSON more Pythonic
This commit is contained in:
1 parent
c5f6bbed3c
commit
cbacef96c9
7 files changed
+130
-133
No files matched your search
+24
-23
@@ -9,7 +9,7 @@ from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.wizard import Wizard
|
||||
from trytond.report import Report
|
||||
from trytond.tools import reduce_ids
|
||||
from trytond.pyson import Equal, Eval, Not, PYSONEncoder, Date, Get
|
||||
from trytond.pyson import Eval, PYSONEncoder, Date
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
@@ -154,7 +154,7 @@ class Type(ModelSQL, ModelView):
|
||||
name = fields.Char('Name', size=None, required=True, translate=True)
|
||||
parent = fields.Many2One('account.account.type', 'Parent',
|
||||
ondelete="RESTRICT", domain=[
|
||||
('company', '=', Get(Eval('context', {}), 'company')),
|
||||
('company', '=', Eval('context', {}).get('company')),
|
||||
])
|
||||
childs = fields.One2Many('account.account.type', 'parent', 'Children',
|
||||
domain=[
|
||||
@@ -317,17 +317,17 @@ class AccountTemplate(ModelSQL, ModelView):
|
||||
select=1)
|
||||
code = fields.Char('Code', size=None, select=1)
|
||||
type = fields.Many2One('account.account.type.template', 'Type',
|
||||
ondelete="RESTRICT",
|
||||
states={
|
||||
'invisible': Equal(Eval('kind'), 'view'),
|
||||
'required': Not(Equal(Eval('kind'), 'view')),
|
||||
ondelete="RESTRICT",
|
||||
states={
|
||||
'invisible': Eval('kind') == 'view',
|
||||
'required': Eval('kind') != 'view',
|
||||
}, depends=['kind'])
|
||||
parent = fields.Many2One('account.account.template', 'Parent', select=1,
|
||||
ondelete="RESTRICT")
|
||||
childs = fields.One2Many('account.account.template', 'parent', 'Children')
|
||||
reconcile = fields.Boolean('Reconcile',
|
||||
states={
|
||||
'invisible': Equal(Eval('kind'), 'view'),
|
||||
states={
|
||||
'invisible': Eval('kind') == 'view',
|
||||
}, depends=['kind'])
|
||||
kind = fields.Selection([
|
||||
('other', 'Other'),
|
||||
@@ -338,8 +338,8 @@ class AccountTemplate(ModelSQL, ModelView):
|
||||
('view', 'View'),
|
||||
], 'Kind', required=True)
|
||||
deferral = fields.Boolean('Deferral', states={
|
||||
'invisible': Equal(Eval('kind'), 'view'),
|
||||
}, depends=['kind'])
|
||||
'invisible': Eval('kind') == 'view',
|
||||
}, depends=['kind'])
|
||||
|
||||
def __init__(self):
|
||||
super(AccountTemplate, self).__init__()
|
||||
@@ -533,11 +533,12 @@ class Account(ModelSQL, ModelView):
|
||||
help='Force all moves for this account \n' \
|
||||
'to have this secondary currency.', ondelete="RESTRICT")
|
||||
type = fields.Many2One('account.account.type', 'Type', ondelete="RESTRICT",
|
||||
states={
|
||||
'invisible': Equal(Eval('kind'), 'view'),
|
||||
'required': Not(Equal(Eval('kind'), 'view')),
|
||||
}, domain=[
|
||||
('company', '=', Eval('company')),
|
||||
states={
|
||||
'invisible': Eval('kind') == 'view',
|
||||
'required': Eval('kind') == 'view',
|
||||
},
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
], depends=['kind', 'company'])
|
||||
parent = fields.Many2One('account.account', 'Parent', select=1,
|
||||
left="left", right="right", ondelete="RESTRICT")
|
||||
@@ -554,10 +555,10 @@ class Account(ModelSQL, ModelView):
|
||||
digits=(16, Eval('currency_digits', 2)), depends=['currency_digits']),
|
||||
'get_credit_debit')
|
||||
reconcile = fields.Boolean('Reconcile',
|
||||
help='Allow move lines of this account \n' \
|
||||
'to be reconciled.',
|
||||
states={
|
||||
'invisible': Equal(Eval('kind'), 'view'),
|
||||
help='Allow move lines of this account \n' \
|
||||
'to be reconciled.',
|
||||
states={
|
||||
'invisible': Eval('kind') == 'view',
|
||||
}, depends=['kind'])
|
||||
note = fields.Text('Note')
|
||||
kind = fields.Selection([
|
||||
@@ -569,11 +570,11 @@ class Account(ModelSQL, ModelView):
|
||||
('view', 'View'),
|
||||
], 'Kind', required=True)
|
||||
deferral = fields.Boolean('Deferral', states={
|
||||
'invisible': Equal(Eval('kind'), 'view'),
|
||||
}, depends=['kind'])
|
||||
'invisible': Eval('kind') == 'view',
|
||||
}, depends=['kind'])
|
||||
deferrals = fields.One2Many('account.account.deferral', 'account',
|
||||
'Deferrals', readonly=True, states={
|
||||
'invisible': Equal(Eval('kind'), 'view'),
|
||||
'Deferrals', readonly=True, states={
|
||||
'invisible': Eval('kind') == 'view',
|
||||
}, depends=['kind'])
|
||||
template = fields.Many2One('account.account.template', 'Template')
|
||||
|
||||
|
||||
+5
-5
@@ -6,12 +6,12 @@ from dateutil.relativedelta import relativedelta
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.wizard import Wizard
|
||||
from trytond.tools import datetime_strftime
|
||||
from trytond.pyson import Equal, Eval, If, In, Get
|
||||
from trytond.pyson import Eval, If
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
STATES = {
|
||||
'readonly': Equal(Eval('state'), 'close'),
|
||||
'readonly': Eval('state') == 'close',
|
||||
}
|
||||
DEPENDS = ['state']
|
||||
|
||||
@@ -45,9 +45,9 @@ class FiscalYear(ModelSQL, ModelView):
|
||||
},
|
||||
depends=['company'])
|
||||
company = fields.Many2One('company.company', 'Company', required=True,
|
||||
domain=[
|
||||
('id', If(In('company', Eval('context', {})), '=', '!='),
|
||||
Get(Eval('context', {}), 'company', 0)),
|
||||
domain=[
|
||||
('id', If(Eval('context', {}).contains('company'), '=', '!='),
|
||||
Eval('context', {}).get('company', 0)),
|
||||
])
|
||||
|
||||
def __init__(self):
|
||||
|
||||
+27
-27
@@ -3,12 +3,12 @@
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.wizard import Wizard
|
||||
from trytond.backend import TableHandler
|
||||
from trytond.pyson import Equal, Eval, Not, Get, Or, And, Bool
|
||||
from trytond.pyson import Eval, Bool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
STATES = {
|
||||
'readonly': Equal(Eval('state'), 'close'),
|
||||
'readonly': Eval('state') == 'close',
|
||||
}
|
||||
DEPENDS = ['state']
|
||||
|
||||
@@ -87,33 +87,33 @@ class Journal(ModelSQL, ModelView):
|
||||
centralised = fields.Boolean('Centralised counterpart')
|
||||
update_posted = fields.Boolean('Allow cancelling moves')
|
||||
sequence = fields.Property(fields.Many2One('ir.sequence', 'Sequence',
|
||||
domain=[('code', '=', 'account.journal')],
|
||||
context={'code': 'account.journal'},
|
||||
states={
|
||||
'required': Bool(Get(Eval('context', {}), 'company', 0)),
|
||||
}))
|
||||
domain=[('code', '=', 'account.journal')],
|
||||
context={'code': 'account.journal'},
|
||||
states={
|
||||
'required': Bool(Eval('context', {}).get('company', 0)),
|
||||
}))
|
||||
credit_account = fields.Property(fields.Many2One('account.account',
|
||||
'Default Credit Account', domain=[
|
||||
('kind', '!=', 'view'),
|
||||
('company', '=', Get(Eval('context', {}), 'company', 0)),
|
||||
],
|
||||
states={
|
||||
'required': And(Or(Bool(Eval('centralised')),
|
||||
Equal(Eval('type'), 'cash')),
|
||||
Bool(Get(Eval('context', {}), 'company', 0))),
|
||||
'invisible': Not(Bool(Get(Eval('context', {}), 'company', 0))),
|
||||
}, depends=['type', 'centralised']))
|
||||
'Default Credit Account', domain=[
|
||||
('kind', '!=', 'view'),
|
||||
('company', '=', Eval('context', {}).get('company', 0)),
|
||||
],
|
||||
states={
|
||||
'required': ((Eval('centralised', False)
|
||||
| (Eval('type') == 'cash'))
|
||||
& Bool(Eval('context', {}).get('company', 0))),
|
||||
'invisible': ~Eval('context', {}).get('company', 0),
|
||||
}, depends=['type', 'centralised']))
|
||||
debit_account = fields.Property(fields.Many2One('account.account',
|
||||
'Default Debit Account', domain=[
|
||||
('kind', '!=', 'view'),
|
||||
('company', '=', Get(Eval('context', {}), 'company', 0)),
|
||||
],
|
||||
states={
|
||||
'required': And(Or(Bool(Eval('centralised')),
|
||||
Equal(Eval('type'), 'cash')),
|
||||
Bool(Get(Eval('context', {}), 'company', 0))),
|
||||
'invisible': Not(Bool(Get(Eval('context', {}), 'company', 0))),
|
||||
}, depends=['type', 'centralised']))
|
||||
'Default Debit Account', domain=[
|
||||
('kind', '!=', 'view'),
|
||||
('company', '=', Eval('context', {}).get('company', 0)),
|
||||
],
|
||||
states={
|
||||
'required': ((Eval('centralised', False)
|
||||
| (Eval('type') == 'cash'))
|
||||
& Bool(Eval('context', {}).get('company', 0))),
|
||||
'invisible': ~Eval('context', {}).get('company', 0),
|
||||
}, depends=['type', 'centralised']))
|
||||
|
||||
def __init__(self):
|
||||
super(Journal, self).__init__()
|
||||
|
||||
@@ -12,17 +12,17 @@ from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.wizard import Wizard
|
||||
from trytond.report import Report
|
||||
from trytond.backend import TableHandler, FIELDS
|
||||
from trytond.pyson import Equal, Eval, Get, PYSONEncoder
|
||||
from trytond.pyson import Eval, PYSONEncoder
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
_MOVE_STATES = {
|
||||
'readonly': Equal(Eval('state'), 'posted'),
|
||||
}
|
||||
'readonly': Eval('state') == 'posted',
|
||||
}
|
||||
_MOVE_DEPENDS = ['state']
|
||||
_LINE_STATES = {
|
||||
'readonly': Equal(Eval('state'), 'valid'),
|
||||
}
|
||||
'readonly': Eval('state') == 'valid',
|
||||
}
|
||||
_LINE_DEPENDS = ['state']
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ class Line(ModelSQL, ModelView):
|
||||
move = fields.Many2One('account.move', 'Move', select=1, required=True,
|
||||
states={
|
||||
'required': False,
|
||||
'readonly': Equal(Eval('state'), 'valid'),
|
||||
'readonly': Eval('state') == 'valid',
|
||||
},
|
||||
depends=['state'])
|
||||
journal = fields.Function(fields.Many2One('account.journal', 'Journal'),
|
||||
@@ -1307,10 +1307,10 @@ class OpenJournalAsk(ModelView):
|
||||
_description = __doc__
|
||||
journal = fields.Many2One('account.journal', 'Journal', required=True)
|
||||
period = fields.Many2One('account.period', 'Period', required=True,
|
||||
domain=[
|
||||
('state', '!=', 'close'),
|
||||
('fiscalyear.company.id', '=',
|
||||
Get(Eval('context', {}), 'company', 0)),
|
||||
domain=[
|
||||
('state', '!=', 'close'),
|
||||
('fiscalyear.company.id', '=',
|
||||
Eval('context', {}).get('company', 0)),
|
||||
])
|
||||
|
||||
def default_period(self):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
from decimal import Decimal
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.pyson import Get, Eval, And, Bool, Not, Or
|
||||
from trytond.pyson import Eval, Bool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
@@ -12,32 +12,32 @@ class Party(ModelSQL, ModelView):
|
||||
account_payable = fields.Property(fields.Many2One('account.account',
|
||||
'Account Payable', domain=[
|
||||
('kind', '=', 'payable'),
|
||||
('company', '=', Get(Eval('context', {}), 'company')),
|
||||
('company', '=', Eval('context', {}).get('company')),
|
||||
],
|
||||
states={
|
||||
'required': Bool(Get(Eval('context', {}), 'company')),
|
||||
'invisible': Not(Bool(Get(Eval('context', {}), 'company'))),
|
||||
'required': Bool(Eval('context', {}).get('company')),
|
||||
'invisible': ~Eval('context', {}).get('company'),
|
||||
}))
|
||||
account_receivable = fields.Property(fields.Many2One('account.account',
|
||||
'Account Receivable', domain=[
|
||||
('kind', '=', 'receivable'),
|
||||
('company', '=', Get(Eval('context', {}), 'company')),
|
||||
('company', '=', Eval('context', {}).get('company', 0)),
|
||||
],
|
||||
states={
|
||||
'required': Bool(Get(Eval('context', {}), 'company')),
|
||||
'invisible': Not(Bool(Get(Eval('context', {}), 'company'))),
|
||||
'required': Bool(Eval('context', {}).get('company')),
|
||||
'invisible': ~Eval('context', {}).get('company'),
|
||||
}))
|
||||
customer_tax_rule = fields.Property(fields.Many2One('account.tax.rule',
|
||||
'Customer Tax Rule',
|
||||
domain=[('company', '=', Get(Eval('context', {}), 'company'))],
|
||||
domain=[('company', '=', Eval('context', {}).get('company', 0))],
|
||||
states={
|
||||
'invisible': Not(Bool(Get(Eval('context', {}), 'company'))),
|
||||
'invisible': ~Eval('context', {}).get('company'),
|
||||
}, help='Apply this rule on taxes when party is customer.'))
|
||||
supplier_tax_rule = fields.Property(fields.Many2One('account.tax.rule',
|
||||
'Supplier Tax Rule',
|
||||
domain=[('company', '=', Get(Eval('context', {}), 'company'))],
|
||||
domain=[('company', '=', Eval('context', {}).get('company', 0))],
|
||||
states={
|
||||
'invisible': Not(Bool(Get(Eval('context', {}), 'company'))),
|
||||
'invisible': ~Eval('context', {}).get('company'),
|
||||
}, help='Apply this rule on taxes when party is supplier.'))
|
||||
receivable = fields.Function(fields.Numeric('Receivable'),
|
||||
'get_receivable_payable', searcher='search_receivable_payable')
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import ModelView, ModelSQL, fields, OPERATORS
|
||||
from trytond.wizard import Wizard
|
||||
from trytond.pyson import Equal, Eval
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
_STATES = {
|
||||
'readonly': Equal(Eval('state'), 'close'),
|
||||
'readonly': Eval('state') == 'close',
|
||||
}
|
||||
_DEPENDS = ['state']
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ from decimal import Decimal
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.wizard import Wizard
|
||||
from trytond.backend import TableHandler
|
||||
from trytond.pyson import Eval, Not, Equal, If, In, Bool, Get, Or, And, \
|
||||
PYSONEncoder
|
||||
from trytond.pyson import Eval, If, Bool, PYSONEncoder
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.cache import Cache
|
||||
from trytond.pool import Pool
|
||||
@@ -311,14 +310,14 @@ class OpenChartCodeInit(ModelView):
|
||||
('periods', 'By Periods'),
|
||||
], 'Method', required=True)
|
||||
fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year',
|
||||
help='Leave empty for all open fiscal year',
|
||||
states={
|
||||
'invisible': Not(Equal(Eval('method'), 'fiscalyear')),
|
||||
help='Leave empty for all open fiscal year',
|
||||
states={
|
||||
'invisible': Eval('method') != 'fiscalyear',
|
||||
}, depends=['method'])
|
||||
periods = fields.Many2Many('account.period', None, None, 'Periods',
|
||||
help='Leave empty for all periods of all open fiscal year',
|
||||
states={
|
||||
'invisible': Not(Equal(Eval('method'), 'periods')),
|
||||
help='Leave empty for all periods of all open fiscal year',
|
||||
states={
|
||||
'invisible': Eval('method') != 'periods',
|
||||
}, depends=['method'])
|
||||
|
||||
def default_method(self):
|
||||
@@ -581,12 +580,13 @@ class Tax(ModelSQL, ModelView):
|
||||
currency_digits = fields.Function(fields.Integer('Currency Digits',
|
||||
on_change_with=['company']), 'get_currency_digits')
|
||||
amount = fields.Numeric('Amount', digits=(16, Eval('currency_digits', 2)),
|
||||
states={
|
||||
'invisible': Not(Equal(Eval('type'), 'fixed')),
|
||||
}, help='In company\'s currency', depends=['type', 'currency_digits'])
|
||||
states={
|
||||
'invisible': Eval('type') != 'fixed',
|
||||
}, help='In company\'s currency',
|
||||
depends=['type', 'currency_digits'])
|
||||
percentage = fields.Numeric('Percentage', digits=(16, 8),
|
||||
states={
|
||||
'invisible': Not(Equal(Eval('type'), 'percentage')),
|
||||
states={
|
||||
'invisible': Eval('type') != 'percentage',
|
||||
}, help='In %', depends=['type'])
|
||||
type = fields.Selection([
|
||||
('percentage', 'Percentage'),
|
||||
@@ -596,9 +596,9 @@ class Tax(ModelSQL, ModelView):
|
||||
parent = fields.Many2One('account.tax', 'Parent', ondelete='CASCADE')
|
||||
childs = fields.One2Many('account.tax', 'parent', 'Children')
|
||||
company = fields.Many2One('company.company', 'Company', required=True,
|
||||
domain=[
|
||||
('id', If(In('company', Eval('context', {})), '=', '!='),
|
||||
Get(Eval('context', {}), 'company', 0)),
|
||||
domain=[
|
||||
('id', If(Eval('context', {}).contains('company'), '=', '!='),
|
||||
Eval('context', {}).get('company', 0)),
|
||||
])
|
||||
invoice_account = fields.Many2One('account.account', 'Invoice Account',
|
||||
domain=[
|
||||
@@ -606,10 +606,8 @@ class Tax(ModelSQL, ModelView):
|
||||
('kind', '!=', 'view'),
|
||||
],
|
||||
states={
|
||||
'readonly': Or(Equal(Eval('type'), 'none'),
|
||||
Not(Bool(Eval('company')))),
|
||||
'required': And(Not(Equal(Eval('type'), 'none')),
|
||||
Bool(Eval('company'))),
|
||||
'readonly': (Eval('type') == 'none') | ~Eval('company'),
|
||||
'required': (Eval('type') != 'none') & Eval('company'),
|
||||
},
|
||||
depends=['company', 'type'])
|
||||
credit_note_account = fields.Many2One('account.account', 'Credit Note Account',
|
||||
@@ -618,51 +616,49 @@ class Tax(ModelSQL, ModelView):
|
||||
('kind', '!=', 'view'),
|
||||
],
|
||||
states={
|
||||
'readonly': Or(Equal(Eval('type'), 'none'),
|
||||
Not(Bool(Eval('company')))),
|
||||
'required': And(Not(Equal(Eval('type'), 'none')),
|
||||
Bool(Eval('company'))),
|
||||
'readonly': (Eval('type') == 'none') | ~Eval('company'),
|
||||
'required': (Eval('type') != 'none') & Eval('company'),
|
||||
},
|
||||
depends=['company', 'type'])
|
||||
invoice_base_code = fields.Many2One('account.tax.code',
|
||||
'Invoice Base Code',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
'Invoice Base Code',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
invoice_base_sign = fields.Numeric('Invoice Base Sign', digits=(2, 0),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
invoice_tax_code = fields.Many2One('account.tax.code',
|
||||
'Invoice Tax Code',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
'Invoice Tax Code',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
invoice_tax_sign = fields.Numeric('Invoice Tax Sign', digits=(2, 0),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
credit_note_base_code = fields.Many2One('account.tax.code',
|
||||
'Credit Note Base Code',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
'Credit Note Base Code',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
credit_note_base_sign = fields.Numeric('Credit Note Base Sign', digits=(2, 0),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
credit_note_tax_code = fields.Many2One('account.tax.code',
|
||||
'Credit Note Tax Code',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
'Credit Note Tax Code',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
credit_note_tax_sign = fields.Numeric('Credit Note Tax Sign', digits=(2, 0),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Equal(Eval('type'), 'none'),
|
||||
help='Usualy 1 or -1',
|
||||
states={
|
||||
'readonly': Eval('type') == 'none',
|
||||
}, depends=['type'])
|
||||
template = fields.Many2One('account.tax.template', 'Template')
|
||||
|
||||
@@ -1024,9 +1020,9 @@ class Rule(ModelSQL, ModelView):
|
||||
_description = __doc__
|
||||
name = fields.Char('Name', required=True, translate=True)
|
||||
company = fields.Many2One('company.company', 'Company', required=True,
|
||||
select=1, domain=[
|
||||
('id', If(In('company', Eval('context', {})), '=', '!='),
|
||||
Get(Eval('context', {}), 'company', 0)),
|
||||
select=1, domain=[
|
||||
('id', If(Eval('context', {}).contains('company'), '=', '!='),
|
||||
Eval('context', {}).get('company', 0)),
|
||||
])
|
||||
lines = fields.One2Many('account.tax.rule.line', 'rule', 'Lines')
|
||||
template = fields.Many2One('account.tax.rule.template', 'Template')
|
||||
@@ -1115,7 +1111,7 @@ class RuleLineTemplate(ModelSQL, ModelView):
|
||||
group = fields.Many2One('account.tax.group', 'Tax Group')
|
||||
origin_tax = fields.Many2One('account.tax.template', 'Original Tax',
|
||||
domain=[
|
||||
('account', '=', Get(Eval('_parent_rule', {}), 'account')),
|
||||
('account', '=', Eval('_parent_rule', {}).get('account', 0)),
|
||||
('group', '=', Eval('group'))
|
||||
],
|
||||
help='If the original tax template is filled, the rule will be ' \
|
||||
@@ -1123,7 +1119,7 @@ class RuleLineTemplate(ModelSQL, ModelView):
|
||||
depends=['group'])
|
||||
tax = fields.Many2One('account.tax.template', 'Substitution Tax',
|
||||
domain=[
|
||||
('account', '=', Get(Eval('_parent_rule', {}), 'account')),
|
||||
('account', '=', Eval('_parent_rule', {}).get('account', 0)),
|
||||
('group', '=', Eval('group')),
|
||||
],
|
||||
depends=['group'])
|
||||
@@ -1210,7 +1206,7 @@ class RuleLine(ModelSQL, ModelView):
|
||||
group = fields.Many2One('account.tax.group', 'Tax Group')
|
||||
origin_tax = fields.Many2One('account.tax', 'Original Tax',
|
||||
domain=[
|
||||
('company', '=', Get(Eval('_parent_rule', {}), 'company')),
|
||||
('company', '=', Eval('_parent_rule', {}).get('company')),
|
||||
('group', '=', Eval('group')),
|
||||
],
|
||||
help='If the original tax is filled, the rule will be applied ' \
|
||||
@@ -1218,7 +1214,7 @@ class RuleLine(ModelSQL, ModelView):
|
||||
depends=['group'])
|
||||
tax = fields.Many2One('account.tax', 'Substitution Tax',
|
||||
domain=[
|
||||
('company', '=', Get(Eval('_parent_rule', {}), 'company')),
|
||||
('company', '=', Eval('_parent_rule', {}).get('company')),
|
||||
('group', '=', Eval('group')),
|
||||
],
|
||||
depends=['group'])
|
||||
|
||||
Reference in new issue
Block a user