Compare commits

..

11 commits
6.0 ... main

Author SHA1 Message Date
Frederik Jaeckel
1bfa987746 Use 'irrulecontext' to add 'user_id' to context of ir.rule 2024-07-19 16:02:19 +02:00
Frederik Jaeckel
f7fee173d7 update gitignore 2024-07-19 16:01:44 +02:00
Frederik Jaeckel
a98b4387c4 ir-rule: condition --> Eval('user_id', -1) 2023-12-04 20:05:06 +01:00
Frederik Jaeckel
176c8d93a7 Tryton 7.0 2023-12-01 12:15:17 +01:00
Frederik Jaeckel
126daacf0a formatting 2023-12-01 12:13:39 +01:00
Frederik Jaeckel
e0e1fd07a7 Tryton 6.8: indexes + tests changed 2023-06-05 21:28:09 +02:00
Frederik Jaeckel
4ae07b962f formatting 2023-06-05 21:06:03 +02:00
Frederik Jaeckel
91674d81e3 setup 2nd 2023-02-14 10:39:35 +01:00
Frederik Jaeckel
6457a8a4ac setup.py 2023-02-14 10:37:25 +01:00
Frederik Jaeckel
68961c4675 category: remove left/right 2023-02-05 14:07:54 +01:00
Frederik Jaeckel
a9c627a63b ansicht der verbundenen kassenbücher an der kategorie + test 2022-11-08 16:56:25 +01:00
12 changed files with 73 additions and 84 deletions

View file

@ -1,4 +1,4 @@
syntax: glob
*.pyc
build/*
mds_cashbook_bookcategory.egg-info/*
dist/*

View file

@ -9,27 +9,11 @@ pip install mds-cashbook-bookcategory
Requires
========
- Tryton 6.0
- Tryton 7.0
Changes
=======
*6.0.4 - 05.06.2023*
*7.0.0 - 01.12.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
- compatibilty to Tryton 7.0

View file

@ -6,6 +6,7 @@
from trytond.pool import Pool
from .category import Category
from .book import CategoryCashbookRel, Cashbook
from .ir import Rule
def register():
@ -13,4 +14,5 @@ def register():
Category,
Cashbook,
CategoryCashbookRel,
Rule,
module='cashbook_bookcategory', type_='model')

View file

@ -22,10 +22,10 @@ class CategoryCashbookRel(ModelSQL):
__name__ = 'cashbook.bookcategory-rel'
category = fields.Many2One(
string='Category', required=True, select=True,
string='Category', required=True,
model_name='cashbook.bookcategory', ondelete='CASCADE')
cashbook = fields.Many2One(
string='Cashbook', required=True, select=True,
string='Cashbook', required=True,
model_name='cashbook.book', ondelete='CASCADE')
# end CategoryCashbookRel

View file

@ -17,7 +17,7 @@ class Category(tree(separator=' / '), ModelSQL, ModelView):
name = fields.Char(string='Name', required=True, translate=True)
parent = fields.Many2One(
string='Parent', select=True,
string='Parent',
model_name='cashbook.bookcategory', ondelete='CASCADE')
childs = fields.One2Many(
string='Children', field='parent',

View file

@ -115,7 +115,7 @@
</record>
<record model="ir.rule" id="rg_category_rw_owner-1">
<field name="domain" eval="[
('create_uid.id', '=', Eval('user', {}).get('id', -1)),
('create_uid.id', '=', Eval('user_id', -1)),
]" pyson="1"/>
<field name="rule_group" ref="rg_category_rw_owner"/>
</record>

21
ir.py Normal file
View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds.de for Tryton.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from trytond.pool import PoolMeta
class Rule(metaclass=PoolMeta):
__name__ = 'ir.rule'
@classmethod
def _context_modelnames(cls):
""" list of models to add 'user_id' to context
"""
result = super(Rule, cls)._context_modelnames()
return result | {
'cashbook.bookcategory',
}
# end Rule

View file

@ -2,7 +2,7 @@
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
@ -36,10 +36,10 @@ with open(path.join(here, 'versiondep.txt'), encoding='utf-8') as f:
l2 = i.strip().split(';')
if len(l2) < 4:
continue
modversion[l2[0]] = {'min':l2[1], 'max':l2[2], 'prefix':l2[3]}
modversion[l2[0]] = {'min': l2[1], 'max': l2[2], 'prefix': l2[3]}
# tryton-version
major_version = 6
major_version = 7
minor_version = 0
requires = []
@ -51,19 +51,21 @@ for dep in info.get('depends', []):
prefix = modversion[dep]['prefix']
if len(modversion[dep]['max']) > 0:
requires.append('%s_%s >= %s, <= %s' %
(prefix, dep, modversion[dep]['min'], modversion[dep]['max']))
else :
requires.append('%s_%s >= %s' %
(prefix, dep, modversion[dep]['min']))
else :
requires.append('%s_%s >= %s.%s, < %s.%s' %
('trytond', dep, major_version, minor_version,
requires.append('%s_%s >= %s, <= %s' % (
prefix, dep, modversion[dep]['min'],
modversion[dep]['max']))
else:
requires.append('%s_%s >= %s' % (
prefix, dep, modversion[dep]['min']))
else:
requires.append('%s_%s >= %s.%s, < %s.%s' % (
'trytond', dep, major_version, minor_version,
major_version, minor_version + 1))
requires.append('trytond >= %s.%s, < %s.%s' %
(major_version, minor_version, major_version, minor_version + 1))
requires.append('trytond >= %s.%s, < %s.%s' % (
major_version, minor_version, major_version, minor_version + 1))
setup(name='%s_%s' % (PREFIX, MODULE),
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,
@ -74,35 +76,33 @@ setup(name='%s_%s' % (PREFIX, MODULE),
author_email='service@m-ds.de',
license='GPL-3',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Plugins',
'Framework :: Tryton',
'Intended Audience :: Developers',
'Intended Audience :: Customer Service',
'Intended Audience :: Information Technology',
'Intended Audience :: Financial and Insurance Industry',
'Topic :: Office/Business',
'Topic :: Office/Business :: Financial :: Accounting',
'Natural Language :: German',
'Natural Language :: English',
'Operating System :: OS Independent',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Development Status :: 5 - Production/Stable',
'Environment :: Plugins',
'Framework :: Tryton',
'Intended Audience :: Developers',
'Intended Audience :: Customer Service',
'Intended Audience :: Information Technology',
'Intended Audience :: Financial and Insurance Industry',
'Topic :: Office/Business',
'Topic :: Office/Business :: Financial :: Accounting',
'Natural Language :: German',
'Natural Language :: English',
'Operating System :: OS Independent',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
keywords='tryton cashbook category',
package_dir={'trytond.modules.%s' % MODULE: '.'},
packages=[
'trytond.modules.%s' % MODULE,
],
package_data={
'trytond.modules.%s' % MODULE: (info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po', 'tests/*.py',
'view/*.xml',
'versiondep.txt', 'README.rst']),
'trytond.modules.%s' % MODULE: (info.get('xml', []) + [
'tryton.cfg', 'locale/*.po', 'tests/*.py',
'view/*.xml', 'versiondep.txt', 'README.rst']),
},
install_requires=requires,
zip_safe=False,
entry_points="""

View file

@ -2,25 +2,3 @@
# 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 .test_category import CategoryTestCase
__all__ = ['suite']
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))
return suite

View file

@ -6,7 +6,7 @@
from trytond.tests.test_tryton import with_transaction
from trytond.pool import Pool
from trytond.transaction import Transaction
from trytond.modules.cashbook.tests import CashbookTestCase
from trytond.modules.cashbook.tests.test_module import CashbookTestCase
class CategoryTestCase(CashbookTestCase):
@ -98,3 +98,6 @@ class CategoryTestCase(CashbookTestCase):
self.assertEqual(len(book.categories), 0)
# end CategoryTestCase
del CashbookTestCase

View file

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

View file

@ -1 +1,2 @@
cashbook;6.0.28;6.0.999;mds
cashbook;7.0.31;7.0.999;mds