line: disable column 'quantity_balance' if cashbook-feature != asset
This commit is contained in:
parent
8acfa35289
commit
4ef14cd44b
5 changed files with 50 additions and 7 deletions
18
line.py
18
line.py
|
@ -58,9 +58,11 @@ class Line(SecondUomMixin, metaclass=PoolMeta):
|
|||
}, depends=['currency_digits', 'quantity_digits', 'feature']),
|
||||
'on_change_with_asset_rate')
|
||||
quantity_balance = fields.Function(fields.Numeric(string='Quantity',
|
||||
digits=(16, Eval('quantity_digits', 4)),
|
||||
digits=(16, Eval('quantity_digits', 4)), readonly=True,
|
||||
help='Number of shares in the cashbook up to the current row if the default sort applies.',
|
||||
readonly=True, depends=['quantity_digits']),
|
||||
states={
|
||||
'invisible': Eval('feature', '') != 'asset',
|
||||
}, depends=['quantity_digits', 'feature']),
|
||||
'on_change_with_quantity_balance')
|
||||
|
||||
@classmethod
|
||||
|
@ -134,7 +136,7 @@ class Line(SecondUomMixin, metaclass=PoolMeta):
|
|||
})
|
||||
return result
|
||||
|
||||
@fields.depends('id', 'date', 'cashbook', \
|
||||
@fields.depends('id', 'date', 'cashbook', 'feature',\
|
||||
'_parent_cashbook.id', 'reconciliation', \
|
||||
'_parent_reconciliation.start_quantity',\
|
||||
'_parent_reconciliation.state')
|
||||
|
@ -142,10 +144,12 @@ class Line(SecondUomMixin, metaclass=PoolMeta):
|
|||
""" get quantity-balance
|
||||
"""
|
||||
Line2 = Pool().get('cashbook.line')
|
||||
return Line2.get_balance_of_line(self,
|
||||
field_name='quantity',
|
||||
credit_name='quantity_credit',
|
||||
debit_name='quantity_debit')
|
||||
|
||||
if self.feature == 'asset':
|
||||
return Line2.get_balance_of_line(self,
|
||||
field_name='quantity',
|
||||
credit_name='quantity_credit',
|
||||
debit_name='quantity_debit')
|
||||
|
||||
@fields.depends('quantity', 'amount', 'currency_digits', 'quantity_digits')
|
||||
def on_change_with_asset_rate(self, name=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue