line: Feld 'booktransf_feature' + tests

This commit is contained in:
Frederik Jaeckel 2022-12-25 12:08:07 +01:00
parent a051a249e4
commit 7a715d5ea1
5 changed files with 24 additions and 0 deletions

10
line.py
View file

@ -84,6 +84,8 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
'on_change_with_category_view', searcher='search_category_view')
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')
bookingtype = fields.Selection(string='Type', required=True,
help='Type of Booking', selection=sel_bookingtype,
@ -607,6 +609,14 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
if self.cashbook:
return self.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('description')
def on_change_with_descr_short(self, name=None):
""" to speed up list-view