diff --git a/book.py b/book.py
index 65f0839..8390766 100644
--- a/book.py
+++ b/book.py
@@ -3,8 +3,7 @@
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, fields
-from trytond.transaction import Transaction
-from trytond.pool import Pool, PoolMeta
+from trytond.pool import PoolMeta
class Cashbook(metaclass=PoolMeta):
diff --git a/category.py b/category.py
index 06160cc..c5fa3a8 100644
--- a/category.py
+++ b/category.py
@@ -23,6 +23,10 @@ class Category(tree(separator=' / '), ModelSQL, ModelView):
left = fields.Integer(string='Left', 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
def __setup__(cls):
super(Category, cls).__setup__()
diff --git a/locale/de.po b/locale/de.po
index 2372d4e..94fce9d 100644
--- a/locale/de.po
+++ b/locale/de.po
@@ -54,6 +54,10 @@ msgctxt "view:cashbook.bookcategory:"
msgid "General Information"
msgstr "Allgemein"
+msgctxt "view:cashbook.bookcategory:"
+msgid "Cashbooks"
+msgstr "Kassenbücher"
+
msgctxt "field:cashbook.bookcategory,name:"
msgid "Name"
msgstr "Name"
@@ -78,6 +82,10 @@ msgctxt "field:cashbook.bookcategory,right:"
msgid "Right"
msgstr "Rechts"
+msgctxt "field:cashbook.bookcategory,cashbooks:"
+msgid "Cashbooks"
+msgstr "Kassenbücher"
+
#################
# cashbook.book #
diff --git a/locale/en.po b/locale/en.po
index 97cfcf1..7374def 100644
--- a/locale/en.po
+++ b/locale/en.po
@@ -38,6 +38,10 @@ msgctxt "view:cashbook.bookcategory:"
msgid "General Information"
msgstr "General Information"
+msgctxt "view:cashbook.bookcategory:"
+msgid "Cashbooks"
+msgstr "Cashbooks"
+
msgctxt "field:cashbook.bookcategory,name:"
msgid "Name"
msgstr "Name"
@@ -62,6 +66,10 @@ msgctxt "field:cashbook.bookcategory,right:"
msgid "Right"
msgstr "Right"
+msgctxt "field:cashbook.bookcategory,cashbooks:"
+msgid "Cashbooks"
+msgstr "Cashbooks"
+
msgctxt "view:cashbook.book:"
msgid "Categories"
msgstr "Categories"
diff --git a/tests/test_category.py b/tests/test_category.py
index 9677d39..6ec3c31 100644
--- a/tests/test_category.py
+++ b/tests/test_category.py
@@ -78,6 +78,9 @@ class CategoryTestCase(CashbookTestCase):
self.assertEqual(len(book.categories), 1)
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
Book.write(*[
[book],
diff --git a/view/category_form.xml b/view/category_form.xml
index 5366dfc..2d6d58d 100644
--- a/view/category_form.xml
+++ b/view/category_form.xml
@@ -12,6 +12,9 @@ full copyright notices and license terms. -->
+
+
+