splitline: add 'feature' of counterpart

This commit is contained in:
Frederik Jaeckel 2023-01-16 22:01:49 +01:00
parent 3b289b7944
commit 8f180cfaf7
4 changed files with 37 additions and 0 deletions

View file

@ -86,6 +86,8 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
'on_change_with_cashbook')
feature = fields.Function(fields.Char(string='Feature', readonly=True,
states={'invisible': True}), 'on_change_with_feature')
booktransf_feature = fields.Function(fields.Char(string='Feature', readonly=True,
states={'invisible': True}), 'on_change_with_booktransf_feature')
state_cashbook = fields.Function(fields.Selection(string='State of Cashbook',
readonly=True, states={'invisible': True}, selection=sel_state_book),
'on_change_with_state_cashbook')
@ -196,6 +198,14 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
if self.line:
return self.line.cashbook.btype.feature
@fields.depends('booktransf', '_parent_booktransf.feature')
def on_change_with_booktransf_feature(self, name=None):
""" get 'feature' of counterpart
"""
if self.booktransf:
if self.booktransf.btype:
return self.booktransf.btype.feature
@fields.depends('line', '_parent_line.cashbook')
def on_change_with_currency(self, name=None):
""" currency of cashbook