From af0c82560712bd937657230480e59bf4c7183a95 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Wed, 21 Dec 2022 21:55:08 +0100 Subject: [PATCH] line: Feld 'feature' --- line.py | 9 +++++++++ locale/de.po | 4 ++++ locale/en.po | 4 ++++ tests/test_line.py | 1 + view/line_form.xml | 1 + 5 files changed, 19 insertions(+) diff --git a/line.py b/line.py index 53f7fea..57c0c1c 100644 --- a/line.py +++ b/line.py @@ -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 diff --git a/locale/de.po b/locale/de.po index f458099..7af968f 100644 --- a/locale/de.po +++ b/locale/de.po @@ -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 # diff --git a/locale/en.po b/locale/en.po index 88d9807..2493cb4 100644 --- a/locale/en.po +++ b/locale/en.po @@ -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" diff --git a/tests/test_line.py b/tests/test_line.py index e8b7a31..aa6dded 100644 --- a/tests/test_line.py +++ b/tests/test_line.py @@ -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) diff --git a/view/line_form.xml b/view/line_form.xml index df63ac9..7595bcd 100644 --- a/view/line_form.xml +++ b/view/line_form.xml @@ -58,4 +58,5 @@ full copyright notices and license terms. --> +