splitline: add 'feature' of counterpart
This commit is contained in:
parent
bd3e63753f
commit
a8122666d6
4 changed files with 37 additions and 0 deletions
|
@ -770,6 +770,10 @@ msgctxt "field:cashbook.split,feature:"
|
|||
msgid "Feature"
|
||||
msgstr "Merkmal"
|
||||
|
||||
msgctxt "field:cashbook.split,booktransf_feature:"
|
||||
msgid "Feature"
|
||||
msgstr "Merkmal"
|
||||
|
||||
|
||||
#################
|
||||
# cashbook.line #
|
||||
|
@ -998,6 +1002,10 @@ msgctxt "field:cashbook.line,feature:"
|
|||
msgid "Feature"
|
||||
msgstr "Merkmal"
|
||||
|
||||
msgctxt "field:cashbook.line,booktransf_feature:"
|
||||
msgid "Feature"
|
||||
msgstr "Merkmal"
|
||||
|
||||
|
||||
#################
|
||||
# cashbook.type #
|
||||
|
|
|
@ -730,6 +730,10 @@ msgctxt "field:cashbook.split,feature:"
|
|||
msgid "Feature"
|
||||
msgstr "Feature"
|
||||
|
||||
msgctxt "field:cashbook.split,booktransf_feature:"
|
||||
msgid "Feature"
|
||||
msgstr "Feature"
|
||||
|
||||
msgctxt "model:cashbook.line,name:"
|
||||
msgid "Cashbook Line"
|
||||
msgstr "Cashbook Line"
|
||||
|
@ -954,6 +958,10 @@ msgctxt "field:cashbook.line,feature:"
|
|||
msgid "Feature"
|
||||
msgstr "Feature"
|
||||
|
||||
msgctxt "field:cashbook.line,booktransf_feature:"
|
||||
msgid "Feature"
|
||||
msgstr "Feature"
|
||||
|
||||
msgctxt "model:cashbook.type,name:"
|
||||
msgid "Cashbook Type"
|
||||
msgstr "Cashbook Type"
|
||||
|
|
10
splitline.py
10
splitline.py
|
@ -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
|
||||
|
|
|
@ -62,6 +62,12 @@ class SplitLineTestCase(ModuleTestCase):
|
|||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev/Sp|11.00 usd|- [-]')
|
||||
self.assertEqual(book.lines[0].category, None)
|
||||
self.assertEqual(len(book.lines[0].splitlines), 2)
|
||||
|
||||
self.assertEqual(book.lines[0].splitlines[0].feature, 'gen')
|
||||
self.assertEqual(book.lines[0].splitlines[0].booktransf_feature, None)
|
||||
self.assertEqual(book.lines[0].splitlines[1].feature, 'gen')
|
||||
self.assertEqual(book.lines[0].splitlines[1].booktransf_feature, None)
|
||||
|
||||
self.assertEqual(book.lines[0].splitlines[0].rec_name,
|
||||
'Rev/Sp|5.00 usd|from category [Cat1]')
|
||||
self.assertEqual(book.lines[0].splitlines[1].rec_name,
|
||||
|
@ -137,6 +143,11 @@ class SplitLineTestCase(ModuleTestCase):
|
|||
self.assertEqual(len(books[1].lines), 0)
|
||||
self.assertEqual(books[0].lines[0].splitlines[0].feature, 'gen')
|
||||
|
||||
self.assertEqual(books[0].lines[0].splitlines[0].feature, 'gen')
|
||||
self.assertEqual(books[0].lines[0].splitlines[0].booktransf_feature, None)
|
||||
self.assertEqual(books[0].lines[0].splitlines[1].feature, 'gen')
|
||||
self.assertEqual(books[0].lines[0].splitlines[1].booktransf_feature, 'gen')
|
||||
|
||||
# wf: edit -> check
|
||||
Line.wfcheck(books[0].lines)
|
||||
self.assertEqual(len(books[0].lines), 1)
|
||||
|
|
Loading…
Reference in a new issue