line: Feld 'feature'

This commit is contained in:
Frederik Jaeckel 2022-12-21 21:55:08 +01:00
parent 82afd24c20
commit 29193fc0f1
5 changed files with 19 additions and 0 deletions

View file

@ -82,6 +82,8 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
)])
category_view = fields.Function(fields.Char(string='Category', readonly=True),
'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')
bookingtype = fields.Selection(string='Type', required=True,
help='Type of Booking', selection=sel_bookingtype,
@ -598,6 +600,13 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
self.booktransf = None
self.currency2nd = self.on_change_with_currency2nd()
@fields.depends('cashbook', '_parent_cashbook.btype')
def on_change_with_feature(self, name=None):
""" get feature-set
"""
if self.cashbook:
return self.cashbook.btype.feature
@fields.depends('description')
def on_change_with_descr_short(self, name=None):
""" to speed up list-view

View file

@ -982,6 +982,10 @@ msgctxt "help:cashbook.line,rate_2nd_currency:"
msgid "Exchange rate between the currencies of the participating cashbooks."
msgstr "Wechselkurs zwischen der Währungen der beteiligten Kassenbücher."
msgctxt "field:cashbook.line,feature:"
msgid "Feature"
msgstr "Merkmal"
#################
# cashbook.type #

View file

@ -938,6 +938,10 @@ msgctxt "help:cashbook.line,rate_2nd_currency:"
msgid "Exchange rate between the currencies of the participating cashbooks."
msgstr "Exchange rate between the currencies of the participating cashbooks."
msgctxt "field:cashbook.line,feature:"
msgid "Feature"
msgstr "Feature"
msgctxt "model:cashbook.type,name:"
msgid "Cashbook Type"
msgstr "Cashbook Type"

View file

@ -511,6 +511,7 @@ class LineTestCase(ModuleTestCase):
self.assertEqual(book.lines[0].balance, Decimal('1.0'))
self.assertEqual(book.lines[0].reconciliation, None)
self.assertEqual(book.lines[0].state, 'edit')
self.assertEqual(book.lines[0].feature, 'gen')
self.assertEqual(book.lines[1].rec_name, '05/02/2022|Rev|1.00 usd|Text 2 [Cat1]')
self.assertEqual(book.lines[1].balance, Decimal('2.0'))
self.assertEqual(book.lines[1].reconciliation, None)

View file

@ -58,4 +58,5 @@ full copyright notices and license terms. -->
</notebook>
<field name="owner_cashbook"/>
<field name="feature"/>
</form>