line: quantity für transferbuchung + test
This commit is contained in:
parent
d04ba0c385
commit
e0895f3e4c
2 changed files with 104 additions and 3 deletions
21
line.py
21
line.py
|
@ -16,13 +16,20 @@ class Line(metaclass=PoolMeta):
|
|||
quantity = fields.Numeric(string='Quantity',
|
||||
digits=(16, Eval('quantity_digits', 4)),
|
||||
states={
|
||||
'required': Eval('feature', '') == 'asset',
|
||||
'invisible': Eval('feature', '') != 'asset',
|
||||
'required': Or(
|
||||
Eval('feature', '') == 'asset',
|
||||
Eval('booktransf_feature', '') == 'asset',
|
||||
),
|
||||
'invisible': ~Or(
|
||||
Eval('feature', '') == 'asset',
|
||||
Eval('booktransf_feature', '') == 'asset',
|
||||
),
|
||||
'readonly': Or(
|
||||
STATES['readonly'],
|
||||
Eval('bookingtype', '').in_(['spin', 'spout']),
|
||||
),
|
||||
}, depends=DEPENDS+['feature', 'quantity_digits', 'bookingtype'])
|
||||
}, depends=DEPENDS+['feature', 'booktransf_feature',
|
||||
'quantity_digits', 'bookingtype'])
|
||||
quantity_digits = fields.Function(fields.Integer(string='Digits',
|
||||
readonly=True, states={'invisible': True}),
|
||||
'on_change_with_quantity_digits')
|
||||
|
@ -39,6 +46,14 @@ class Line(metaclass=PoolMeta):
|
|||
}, depends=['currency_digits', 'quantity_digits', 'feature']),
|
||||
'on_change_with_asset_rate')
|
||||
|
||||
@classmethod
|
||||
def get_counterpart_values(cls, line, values={}):
|
||||
""" add quantity to counterpart
|
||||
"""
|
||||
result = super(Line, cls).get_counterpart_values(line, values)
|
||||
result['quantity'] = line.quantity
|
||||
return result
|
||||
|
||||
@fields.depends('quantity', 'amount', 'currency_digits', 'quantity_digits')
|
||||
def on_change_with_asset_rate(self, name=None):
|
||||
""" get rate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue