ansicht der verbundenen kassenbücher an der kategorie + test
This commit is contained in:
parent
521b9c290c
commit
a9c627a63b
6 changed files with 27 additions and 2 deletions
3
book.py
3
book.py
|
@ -3,8 +3,7 @@
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import ModelSQL, fields
|
from trytond.model import ModelSQL, fields
|
||||||
from trytond.transaction import Transaction
|
from trytond.pool import PoolMeta
|
||||||
from trytond.pool import Pool, PoolMeta
|
|
||||||
|
|
||||||
|
|
||||||
class Cashbook(metaclass=PoolMeta):
|
class Cashbook(metaclass=PoolMeta):
|
||||||
|
|
|
@ -23,6 +23,10 @@ class Category(tree(separator=' / '), ModelSQL, ModelView):
|
||||||
left = fields.Integer(string='Left', required=True, select=True)
|
left = fields.Integer(string='Left', required=True, select=True)
|
||||||
right = fields.Integer(string='Right', required=True, select=True)
|
right = fields.Integer(string='Right', required=True, select=True)
|
||||||
|
|
||||||
|
cashbooks = fields.Many2Many(string='Cashbooks',
|
||||||
|
relation_name='cashbook.bookcategory-rel',
|
||||||
|
origin='category', target='cashbook')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(Category, cls).__setup__()
|
super(Category, cls).__setup__()
|
||||||
|
|
|
@ -54,6 +54,10 @@ msgctxt "view:cashbook.bookcategory:"
|
||||||
msgid "General Information"
|
msgid "General Information"
|
||||||
msgstr "Allgemein"
|
msgstr "Allgemein"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.bookcategory:"
|
||||||
|
msgid "Cashbooks"
|
||||||
|
msgstr "Kassenbücher"
|
||||||
|
|
||||||
msgctxt "field:cashbook.bookcategory,name:"
|
msgctxt "field:cashbook.bookcategory,name:"
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Name"
|
msgstr "Name"
|
||||||
|
@ -78,6 +82,10 @@ msgctxt "field:cashbook.bookcategory,right:"
|
||||||
msgid "Right"
|
msgid "Right"
|
||||||
msgstr "Rechts"
|
msgstr "Rechts"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.bookcategory,cashbooks:"
|
||||||
|
msgid "Cashbooks"
|
||||||
|
msgstr "Kassenbücher"
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# cashbook.book #
|
# cashbook.book #
|
||||||
|
|
|
@ -38,6 +38,10 @@ msgctxt "view:cashbook.bookcategory:"
|
||||||
msgid "General Information"
|
msgid "General Information"
|
||||||
msgstr "General Information"
|
msgstr "General Information"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.bookcategory:"
|
||||||
|
msgid "Cashbooks"
|
||||||
|
msgstr "Cashbooks"
|
||||||
|
|
||||||
msgctxt "field:cashbook.bookcategory,name:"
|
msgctxt "field:cashbook.bookcategory,name:"
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Name"
|
msgstr "Name"
|
||||||
|
@ -62,6 +66,10 @@ msgctxt "field:cashbook.bookcategory,right:"
|
||||||
msgid "Right"
|
msgid "Right"
|
||||||
msgstr "Right"
|
msgstr "Right"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.bookcategory,cashbooks:"
|
||||||
|
msgid "Cashbooks"
|
||||||
|
msgstr "Cashbooks"
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
msgctxt "view:cashbook.book:"
|
||||||
msgid "Categories"
|
msgid "Categories"
|
||||||
msgstr "Categories"
|
msgstr "Categories"
|
||||||
|
|
|
@ -78,6 +78,9 @@ class CategoryTestCase(CashbookTestCase):
|
||||||
self.assertEqual(len(book.categories), 1)
|
self.assertEqual(len(book.categories), 1)
|
||||||
self.assertEqual(book.categories[0].rec_name, 'Cat 0')
|
self.assertEqual(book.categories[0].rec_name, 'Cat 0')
|
||||||
|
|
||||||
|
self.assertEqual(len(category.cashbooks), 1)
|
||||||
|
self.assertEqual(category.cashbooks[0].rec_name, 'Book 1 | 0.00 usd | Open')
|
||||||
|
|
||||||
# replace category
|
# replace category
|
||||||
Book.write(*[
|
Book.write(*[
|
||||||
[book],
|
[book],
|
||||||
|
|
|
@ -12,6 +12,9 @@ full copyright notices and license terms. -->
|
||||||
<field name="parent"/>
|
<field name="parent"/>
|
||||||
<field name="childs" colspan="4"/>
|
<field name="childs" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
|
<page string="Cashbooks" name="cashbooks" col="1">
|
||||||
|
<field name="cashbooks"/>
|
||||||
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
<field name="company" invisible="1"/>
|
<field name="company" invisible="1"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue