Compare commits

...

13 commits
main ... 6.0

Author SHA1 Message Date
Frederik Jaeckel
4fb5f625ce Etikett ver 6.0.4 zum Änderungssatz 49cc4019bf6d hinzugefügt 2023-06-05 21:39:13 +02:00
Frederik Jaeckel
282917a617 Version 6.0.4 2023-06-05 21:39:00 +02:00
Frederik Jaeckel
f4597378c3 formatting 2023-06-05 21:06:03 +02:00
Frederik Jaeckel
2a4fbbabdd setup 2nd 2023-02-14 10:39:35 +01:00
Frederik Jaeckel
7cf82a82ba setup.py 2023-02-14 10:37:25 +01:00
Frederik Jaeckel
f7fca80ad7 Etikett ver 6.0.3 zum Änderungssatz 59f5a015e463 hinzugefügt 2023-02-05 18:13:54 +01:00
Frederik Jaeckel
07df52b6e9 Version 6.0.3 2023-02-05 18:13:45 +01:00
Frederik Jaeckel
abcb15c20f category: remove left/right 2023-02-05 14:07:54 +01:00
Frederik Jaeckel
032160ce76 Etikett ver 6.0.2 zum Änderungssatz efb060d533fc hinzugefügt 2022-11-08 16:57:43 +01:00
Frederik Jaeckel
bda363b1e1 Version 6.0.2 2022-11-08 16:57:35 +01:00
Frederik Jaeckel
f1ae2932a3 ansicht der verbundenen kassenbücher an der kategorie + test 2022-11-08 16:56:25 +01:00
Frederik Jaeckel
750f5c7594 Etikett ver 6.0.1 zum Änderungssatz 69db0716732b hinzugefügt 2022-11-08 16:29:29 +01:00
Frederik Jaeckel
2da0074d2b Version 6.0.1 2022-11-08 16:29:19 +01:00
12 changed files with 83 additions and 36 deletions

View file

@ -14,6 +14,22 @@ Requires
Changes
=======
*6.0.4 - 05.06.2023*
- code optimized
*6.0.3 - 05.02.2023*
- updt: remove left/right fields
*6.0.2 - 08.11.2022*
- add: show linked cashbook on category-form
*6.0.1 - 08.11.2022*
- works
*6.0.0 - 07.11.2022*
- init

View file

@ -7,6 +7,7 @@ from trytond.pool import Pool
from .category import Category
from .book import CategoryCashbookRel, Cashbook
def register():
Pool.register(
Category,

12
book.py
View file

@ -3,14 +3,14 @@
# 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):
__name__ = 'cashbook.book'
categories = fields.Many2Many(string='Categories',
categories = fields.Many2Many(
string='Categories',
relation_name='cashbook.bookcategory-rel',
origin='cashbook', target='category')
@ -21,9 +21,11 @@ class CategoryCashbookRel(ModelSQL):
'Category Cashbook Relation'
__name__ = 'cashbook.bookcategory-rel'
category = fields.Many2One(string='Category', required=True, select=True,
category = fields.Many2One(
string='Category', required=True, select=True,
model_name='cashbook.bookcategory', ondelete='CASCADE')
cashbook = fields.Many2One(string='Cashbook', required=True, select=True,
cashbook = fields.Many2One(
string='Cashbook', required=True, select=True,
model_name='cashbook.book', ondelete='CASCADE')
# end CategoryCashbookRel

View file

@ -11,31 +11,35 @@ class Category(tree(separator=' / '), ModelSQL, ModelView):
"Cashbook Category"
__name__ = "cashbook.bookcategory"
company = fields.Many2One(string='Company', model_name='company.company',
company = fields.Many2One(
string='Company', model_name='company.company',
required=True, ondelete="RESTRICT")
name = fields.Char(string='Name', required=True, translate=True)
parent = fields.Many2One(string='Parent', select=True,
model_name='cashbook.bookcategory', ondelete='CASCADE',
left='left', right='right')
childs = fields.One2Many(string='Children', field='parent',
parent = fields.Many2One(
string='Parent', select=True,
model_name='cashbook.bookcategory', ondelete='CASCADE')
childs = fields.One2Many(
string='Children', field='parent',
model_name='cashbook.bookcategory')
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 __register__(cls, module_name):
super(Category, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
table.drop_column('left')
table.drop_column('right')
@classmethod
def __setup__(cls):
super(Category, cls).__setup__()
cls._order.insert(0, ('rec_name', 'ASC'))
@staticmethod
def default_left():
return 0
@staticmethod
def default_right():
return 0
@staticmethod
def default_company():
return Transaction().context.get('company') or None

View file

@ -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 #

View file

@ -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"

View file

@ -67,7 +67,9 @@ setup(name='%s_%s' % (PREFIX, MODULE),
version=info.get('version', '0.0.1'),
description='Tryton module to add categories for cashbooks.',
long_description=long_description,
long_description_content_type='text/x-rst',
url='https://www.m-ds.de/',
download_url='https://scmdev.m-ds.de/Tryton/Extra/cashbook_bookcategory',
author='martin-data services',
author_email='service@m-ds.de',
license='GPL-3',

View file

@ -1,24 +1,26 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
# -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
import trytond.tests.test_tryton
import unittest
from trytond.modules.cashbook_bookcategory.tests.test_category import CategoryTestCase
from .test_category import CategoryTestCase
__all__ = ['suite']
class CashbookCategoryTestCase(\
CategoryTestCase,\
):
class CashbookCategoryTestCase(CategoryTestCase):
'Test cashbook module'
module = 'cashbook_bookcategory'
# end CashbookCategoryTestCase
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(CashbookCategoryTestCase))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
CashbookCategoryTestCase))
return suite

View file

@ -3,10 +3,9 @@
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.tests.test_tryton import with_transaction
from trytond.pool import Pool
from trytond.transaction import Transaction
from trytond.exceptions import UserError
from trytond.modules.cashbook.tests import CashbookTestCase
@ -22,8 +21,7 @@ class CategoryTestCase(CashbookTestCase):
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
}):
'company': company.id}):
categories, = BookCategory.create([{
'name': 'Cat 0',
'childs': [('create', [{
@ -56,8 +54,7 @@ class CategoryTestCase(CashbookTestCase):
types = self.prep_type()
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
}):
'company': company.id}):
category, = BookCategory.create([{
'name': 'Cat 0',
'childs': [('create', [{
@ -78,6 +75,11 @@ 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],

View file

@ -1,5 +1,5 @@
[tryton]
version=6.0.0
version=6.0.4
depends:
cashbook
xml:

View file

@ -1,2 +1 @@
cashbook;6.0.19;6.0.999;mds
cashbook;6.0.28;6.0.999;mds

View file

@ -12,6 +12,9 @@ full copyright notices and license terms. -->
<field name="parent"/>
<field name="childs" colspan="4"/>
</page>
<page string="Cashbooks" name="cashbooks" col="1">
<field name="cashbooks"/>
</page>
</notebook>
<field name="company" invisible="1"/>