line: Feld 'booktransf_feature' + tests
This commit is contained in:
parent
a051a249e4
commit
7a715d5ea1
5 changed files with 24 additions and 0 deletions
10
line.py
10
line.py
|
@ -84,6 +84,8 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
'on_change_with_category_view', searcher='search_category_view')
|
'on_change_with_category_view', searcher='search_category_view')
|
||||||
feature = fields.Function(fields.Char(string='Feature', readonly=True,
|
feature = fields.Function(fields.Char(string='Feature', readonly=True,
|
||||||
states={'invisible': True}), 'on_change_with_feature')
|
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,
|
bookingtype = fields.Selection(string='Type', required=True,
|
||||||
help='Type of Booking', selection=sel_bookingtype,
|
help='Type of Booking', selection=sel_bookingtype,
|
||||||
|
@ -607,6 +609,14 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
if self.cashbook:
|
if self.cashbook:
|
||||||
return self.cashbook.btype.feature
|
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')
|
@fields.depends('description')
|
||||||
def on_change_with_descr_short(self, name=None):
|
def on_change_with_descr_short(self, name=None):
|
||||||
""" to speed up list-view
|
""" to speed up list-view
|
||||||
|
|
|
@ -606,6 +606,10 @@ msgctxt "field:cashbook.book,feature:"
|
||||||
msgid "Feature"
|
msgid "Feature"
|
||||||
msgstr "Merkmal"
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# cashbook.split #
|
# cashbook.split #
|
||||||
|
|
|
@ -570,6 +570,10 @@ msgctxt "field:cashbook.book,feature:"
|
||||||
msgid "Feature"
|
msgid "Feature"
|
||||||
msgstr "Feature"
|
msgstr "Feature"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
msgctxt "model:cashbook.split,name:"
|
msgctxt "model:cashbook.split,name:"
|
||||||
msgid "Split booking line"
|
msgid "Split booking line"
|
||||||
msgstr "Split booking line"
|
msgstr "Split booking line"
|
||||||
|
|
|
@ -995,6 +995,11 @@ class LineTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|to|-1.00 usd|Transfer Out [Book 2 | 0.00 usd | Open]')
|
self.assertEqual(book.lines[0].rec_name, '05/01/2022|to|-1.00 usd|Transfer Out [Book 2 | 0.00 usd | Open]')
|
||||||
self.assertEqual(len(book.lines[0].references), 0)
|
self.assertEqual(len(book.lines[0].references), 0)
|
||||||
|
|
||||||
|
# check counterpart
|
||||||
|
self.assertEqual(book.lines[0].booktransf.rec_name, 'Book 2 | 0.00 usd | Open')
|
||||||
|
self.assertEqual(book.lines[0].booktransf.btype.feature, 'gen')
|
||||||
|
self.assertEqual(book.lines[0].booktransf_feature, 'gen')
|
||||||
|
|
||||||
# check payee
|
# check payee
|
||||||
self.assertEqual(book.lines[0].payee.rec_name, 'Book 2 | 0.00 usd | Open')
|
self.assertEqual(book.lines[0].payee.rec_name, 'Book 2 | 0.00 usd | Open')
|
||||||
self.assertEqual(Line.search_count([('payee', 'ilike', 'book 2%')]), 1)
|
self.assertEqual(Line.search_count([('payee', 'ilike', 'book 2%')]), 1)
|
||||||
|
|
|
@ -59,4 +59,5 @@ full copyright notices and license terms. -->
|
||||||
|
|
||||||
<field name="owner_cashbook"/>
|
<field name="owner_cashbook"/>
|
||||||
<field name="feature"/>
|
<field name="feature"/>
|
||||||
|
<field name="booktransf_feature"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue