diff --git a/locale/de.po b/locale/de.po index dec100b..fcb921e 100644 --- a/locale/de.po +++ b/locale/de.po @@ -766,6 +766,10 @@ msgctxt "help:cashbook.split,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.split,feature:" +msgid "Feature" +msgstr "Merkmal" + ################# # cashbook.line # diff --git a/locale/en.po b/locale/en.po index d0c175f..9e2e211 100644 --- a/locale/en.po +++ b/locale/en.po @@ -726,6 +726,10 @@ msgctxt "help:cashbook.split,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.split,feature:" +msgid "Feature" +msgstr "Feature" + msgctxt "model:cashbook.line,name:" msgid "Cashbook Line" msgstr "Cashbook Line" diff --git a/splitline.py b/splitline.py index 9451bba..24c874e 100644 --- a/splitline.py +++ b/splitline.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# This file is part of the cashbook-module from m-ds for Tryton. +# This file is part of the cashbook-module from m-ds.de for Tryton. # The COPYRIGHT file at the top level of this repository contains the # full copyright notices and license terms. @@ -84,6 +84,8 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView): cashbook = fields.Function(fields.Many2One(string='Cashbook', readonly=True, states={'invisible': True}, model_name='cashbook.book'), 'on_change_with_cashbook') + feature = fields.Function(fields.Char(string='Feature', readonly=True, + states={'invisible': True}), 'on_change_with_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') @@ -187,6 +189,13 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView): if self.line: return self.line.bookingtype + @fields.depends('line', '_parent_line.cashbook') + def on_change_with_feature(self, name=None): + """ get feature-set + """ + if self.line: + return self.line.cashbook.btype.feature + @fields.depends('line', '_parent_line.cashbook') def on_change_with_currency(self, name=None): """ currency of cashbook @@ -203,6 +212,17 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView): else: return 2 + @classmethod + def add_2nd_unit_values(cls, values): + """ extend create-values + """ + Line2 = Pool().get('cashbook.line') + line = Line2(values.get('line', None)) + + if line: + values.update(cls.add_2nd_currency(values, line.cashbook.currency)) + return values + @classmethod def create(cls, vlist): """ add debit/credit @@ -211,10 +231,7 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView): vlist = [x.copy() for x in vlist] for values in vlist: - line = Line2(values.get('line', None)) - if line: - values.update(cls.add_2nd_currency(values, line.cashbook.currency)) - + values.update(cls.add_2nd_unit_values(values)) records = super(SplitLine, cls).create(vlist) to_update_line = [] diff --git a/tests/test_splitline.py b/tests/test_splitline.py index ddd9889..79086ee 100644 --- a/tests/test_splitline.py +++ b/tests/test_splitline.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# This file is part of the cashbook-module from m-ds for Tryton. +# This file is part of the cashbook-module from m-ds.de for Tryton. # The COPYRIGHT file at the top level of this repository contains the # full copyright notices and license terms. @@ -84,6 +84,7 @@ class SplitLineTestCase(ModuleTestCase): self.assertEqual(books[0].lines[0].splitlines[1].rec_name, 'Rev/Sp|6.00 usd|from cashbook [Book 2 | 0.00 usd | Open]') self.assertEqual(len(books[1].lines), 0) + self.assertEqual(books[0].lines[0].splitlines[0].feature, 'gen') # wf: edit -> check Line.wfcheck(books[0].lines) diff --git a/view/split_form.xml b/view/split_form.xml index c899966..e69da82 100644 --- a/view/split_form.xml +++ b/view/split_form.xml @@ -1,5 +1,5 @@ -
diff --git a/view/split_list.xml b/view/split_list.xml index 169731f..a7fb318 100644 --- a/view/split_list.xml +++ b/view/split_list.xml @@ -1,9 +1,10 @@ -