Compare commits
113 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
08d8121f57 | ||
![]() |
6aca58bcc2 | ||
![]() |
400ebed692 | ||
![]() |
865a2c7fa6 | ||
![]() |
852ff6871d | ||
![]() |
65437bc52e | ||
![]() |
206cd1e0e5 | ||
![]() |
d0f5b0aa38 | ||
![]() |
52011f5166 | ||
![]() |
f9e55fab77 | ||
![]() |
0442591d52 | ||
![]() |
5ef3a52fdc | ||
![]() |
5d8f924960 | ||
![]() |
9ef465f40f | ||
![]() |
d2ad96db35 | ||
![]() |
e79bcca989 | ||
![]() |
52e788db17 | ||
![]() |
72f0325a71 | ||
![]() |
7e6d2660ad | ||
![]() |
cf92b2d7b5 | ||
![]() |
7062399319 | ||
![]() |
fbdc68c642 | ||
![]() |
7220cff5ac | ||
![]() |
77ee7d15b7 | ||
![]() |
90298d3eb8 | ||
![]() |
e605d5f0d3 | ||
![]() |
2b6731d071 | ||
![]() |
2cf42eb9f6 | ||
![]() |
3467c08895 | ||
![]() |
619a17bcd6 | ||
![]() |
78f160bf0b | ||
![]() |
03324d5944 | ||
![]() |
179543bcf0 | ||
![]() |
befa1db235 | ||
![]() |
39309783b6 | ||
![]() |
624a5bff55 | ||
![]() |
86e6c33cc1 | ||
![]() |
971dbc4520 | ||
![]() |
dbc570bdbf | ||
![]() |
610532f6a5 | ||
![]() |
2d6f034a17 | ||
![]() |
1f92b15756 | ||
![]() |
984aab168a | ||
![]() |
f5eef66f78 | ||
![]() |
cace9ea751 | ||
![]() |
8f180cfaf7 | ||
![]() |
3b289b7944 | ||
![]() |
82ae7d7bca | ||
![]() |
11d6183d65 | ||
![]() |
a9773a42df | ||
![]() |
f2ecd3e174 | ||
![]() |
0138269ea8 | ||
![]() |
2b4d69736b | ||
![]() |
b809d51fe0 | ||
![]() |
e0a6d39bdb | ||
![]() |
7a715d5ea1 | ||
![]() |
a051a249e4 | ||
![]() |
7591c7568d | ||
![]() |
8a563e2d7f | ||
![]() |
63390df9ca | ||
![]() |
3a0e8f290d | ||
![]() |
29193fc0f1 | ||
![]() |
82afd24c20 | ||
![]() |
db84bf7097 | ||
![]() |
a16618bf22 | ||
![]() |
46e82ce73f | ||
![]() |
1ab987d532 | ||
![]() |
63a3f8f020 | ||
![]() |
fc3ddba3ab | ||
![]() |
a521064ddf | ||
![]() |
ef32bd79f9 | ||
![]() |
557a8b47ba | ||
![]() |
94d51b4ee2 | ||
![]() |
5794a4ccb7 | ||
![]() |
5136189386 | ||
![]() |
8910f26c99 | ||
![]() |
3073ce6f8d | ||
![]() |
25dcdde09b | ||
![]() |
0f6180ebdb | ||
![]() |
517e2c5ad3 | ||
![]() |
59dfb94bee | ||
![]() |
4a7ee23e2c | ||
![]() |
b6799e355f | ||
![]() |
3db6822f26 | ||
![]() |
7999440de7 | ||
![]() |
1c22aac197 | ||
![]() |
99abc069d8 | ||
![]() |
2acdc55efb | ||
![]() |
a2e7f192f8 | ||
![]() |
e10616e847 | ||
![]() |
0c099b11b3 | ||
![]() |
165612a627 | ||
![]() |
86922aecef | ||
![]() |
2a44c67ccf | ||
![]() |
9732fe11e9 | ||
![]() |
e3887debe9 | ||
![]() |
953bf248a4 | ||
![]() |
326d87f758 | ||
![]() |
d6ea1b31a6 | ||
![]() |
98ed1ceb6e | ||
![]() |
d1bb86ada3 | ||
![]() |
acf3ca7ce5 | ||
![]() |
adb472dc87 | ||
![]() |
8abe8fc164 | ||
![]() |
ba3892aa03 | ||
![]() |
b78ff02500 | ||
![]() |
24c0e2678e | ||
![]() |
4615c04bce | ||
![]() |
64e9bab592 | ||
![]() |
7fd42c0b42 | ||
![]() |
937124bcaf | ||
![]() |
532d9cc7c8 | ||
![]() |
d383b8f9c1 |
30 changed files with 211 additions and 259 deletions
2
.hgignore → .gitignore
vendored
2
.hgignore → .gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
syntax: glob
|
*.pyc
|
||||||
build/*
|
build/*
|
||||||
dist/*
|
dist/*
|
||||||
mds_cashbook.egg-info/*
|
mds_cashbook.egg-info/*
|
148
README.rst
148
README.rst
|
@ -9,7 +9,7 @@ pip install mds-cashbook
|
||||||
|
|
||||||
Requires
|
Requires
|
||||||
========
|
========
|
||||||
- Tryton 6.0
|
- Tryton 7.0
|
||||||
|
|
||||||
How to
|
How to
|
||||||
======
|
======
|
||||||
|
@ -153,148 +153,6 @@ currency are converted into the display currency of the parent cash book.
|
||||||
Changes
|
Changes
|
||||||
=======
|
=======
|
||||||
|
|
||||||
*6.0.35 - 01.06.2024*
|
*7.0.0 - 30.11.2023*
|
||||||
|
|
||||||
- add: config setting for fixate in booking-wizard
|
- compatibility to Tryton 7.0
|
||||||
|
|
||||||
*6.0.34 - 30.05.2024*
|
|
||||||
|
|
||||||
- add: fixate of booking from booking-wizard
|
|
||||||
|
|
||||||
*6.0.33 - 31.12.2023*
|
|
||||||
|
|
||||||
- remove caching
|
|
||||||
- add worker-based precalculation of cashbook-values
|
|
||||||
|
|
||||||
*6.0.31 - 30.11.2023*
|
|
||||||
|
|
||||||
- optimized ir.rule
|
|
||||||
|
|
||||||
*6.0.30 - 25.07.2023*
|
|
||||||
|
|
||||||
- updt: optimize code, add tests
|
|
||||||
|
|
||||||
*6.0.28 - 05.06.2023*
|
|
||||||
|
|
||||||
- code optimized
|
|
||||||
|
|
||||||
*6.0.27 - 05.03.2023*
|
|
||||||
|
|
||||||
- updt: optimize caching
|
|
||||||
- add: settings for trytond.conf
|
|
||||||
|
|
||||||
*6.0.26 - 27.02.2023*
|
|
||||||
|
|
||||||
- updt: cashbook-form optimized
|
|
||||||
- add: caching
|
|
||||||
|
|
||||||
*6.0.25 - 14.02.2023*
|
|
||||||
|
|
||||||
- fix: possible exception by invalid date in context
|
|
||||||
- updt: optimize table + icon
|
|
||||||
|
|
||||||
*6.0.24 - 05.02.2023*
|
|
||||||
|
|
||||||
- fix: rewrite of line-values
|
|
||||||
|
|
||||||
*6.0.23 - 28.01.2023*
|
|
||||||
|
|
||||||
- fix: selection of subordinate cash books for calculations
|
|
||||||
|
|
||||||
*6.0.22 - 21.01.2023*
|
|
||||||
|
|
||||||
- add: enable extension by investment-module
|
|
||||||
- updt: optimize form/list-views
|
|
||||||
|
|
||||||
*6.0.21 - 29.11.2022*
|
|
||||||
|
|
||||||
- updt: remove 'reconcile' button from line-form
|
|
||||||
- add: how to
|
|
||||||
|
|
||||||
*6.0.20 - 16.11.2022*
|
|
||||||
|
|
||||||
- add: new state 'reconciled' at line
|
|
||||||
|
|
||||||
*6.0.19 - 19.10.2022*
|
|
||||||
|
|
||||||
- fix: delete()
|
|
||||||
|
|
||||||
*6.0.18 - 11.10.2022*
|
|
||||||
|
|
||||||
- updt: optimized open/view of cashbook
|
|
||||||
|
|
||||||
*6.0.17 - 10.10.2022*
|
|
||||||
|
|
||||||
- add: colors for cashbook-lines
|
|
||||||
- add: client stores tree-state of cashbook
|
|
||||||
|
|
||||||
*6.0.16 - 07.10.2022*
|
|
||||||
|
|
||||||
- add: open cashbook-lines from cashbook
|
|
||||||
|
|
||||||
*6.0.15 - 04.10.2022*
|
|
||||||
|
|
||||||
- updt: second-currency support optimized
|
|
||||||
|
|
||||||
*6.0.14 - 30.09.2022*
|
|
||||||
|
|
||||||
- fix: parameter
|
|
||||||
|
|
||||||
*6.0.13 - 28.09.2022*
|
|
||||||
|
|
||||||
- hierarchical ordering for cashbook
|
|
||||||
- forms optimzed
|
|
||||||
|
|
||||||
*6.0.12 - 18.09.2022*
|
|
||||||
|
|
||||||
- add: selected cashbooks in 'enter-booking-dialog'
|
|
||||||
|
|
||||||
*6.0.11 - 16.09.2022*
|
|
||||||
|
|
||||||
- add: hierarchy for cashbooks
|
|
||||||
|
|
||||||
*6.0.10 - 13.09.2022*
|
|
||||||
|
|
||||||
- add: split-booking with transfer
|
|
||||||
|
|
||||||
*6.0.9 - 08.09.2022*
|
|
||||||
|
|
||||||
- updt: allow negative amounts
|
|
||||||
|
|
||||||
*6.0.8 - 07.09.2022*
|
|
||||||
|
|
||||||
- updt: enter-booking form optimized
|
|
||||||
|
|
||||||
*6.0.7 - 07.09.2022*
|
|
||||||
|
|
||||||
- add: enter-booking-wizard
|
|
||||||
|
|
||||||
*6.0.6 - 06.09.2022*
|
|
||||||
|
|
||||||
- updt: optimized form - line, line-context
|
|
||||||
- updt: extended search in cashbook-lines
|
|
||||||
|
|
||||||
*6.0.5 - 05.09.2022*
|
|
||||||
|
|
||||||
- updt: view of book + line optimized
|
|
||||||
|
|
||||||
*6.0.4 - 05.09.2022*
|
|
||||||
|
|
||||||
- fix: write number at state-change 'check' -> 'done'
|
|
||||||
- updt: speedup transaction view
|
|
||||||
|
|
||||||
*6.0.3 - 31.08.2022*
|
|
||||||
|
|
||||||
- updt: checks, sorting
|
|
||||||
|
|
||||||
*6.0.2 - 25.08.2022*
|
|
||||||
|
|
||||||
- add: split-booking
|
|
||||||
|
|
||||||
*6.0.1 - 23.08.2022*
|
|
||||||
|
|
||||||
- works
|
|
||||||
|
|
||||||
*6.0.0 - 05.08.2022*
|
|
||||||
|
|
||||||
- init
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ from .reconciliation import Reconciliation
|
||||||
from .cbreport import ReconciliationReport
|
from .cbreport import ReconciliationReport
|
||||||
from .currency import CurrencyRate
|
from .currency import CurrencyRate
|
||||||
from .valuestore import ValueStore
|
from .valuestore import ValueStore
|
||||||
|
from .ir import Rule
|
||||||
from .cron import Cron
|
from .cron import Cron
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ def register():
|
||||||
RunCbReportStart,
|
RunCbReportStart,
|
||||||
EnterBookingStart,
|
EnterBookingStart,
|
||||||
ValueStore,
|
ValueStore,
|
||||||
|
Rule,
|
||||||
Cron,
|
Cron,
|
||||||
module='cashbook', type_='model')
|
module='cashbook', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
|
|
38
book.py
38
book.py
|
@ -3,7 +3,8 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import Workflow, ModelView, ModelSQL, fields, Check, tree
|
from trytond.model import (
|
||||||
|
Workflow, ModelView, ModelSQL, fields, Check, tree, Index)
|
||||||
from trytond.pyson import Eval, Or, Bool, Id
|
from trytond.pyson import Eval, Or, Bool, Id
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
|
@ -49,13 +50,13 @@ class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
company = fields.Many2One(
|
company = fields.Many2One(
|
||||||
string='Company', model_name='company.company',
|
string='Company', model_name='company.company',
|
||||||
required=True, select=True, ondelete="RESTRICT")
|
required=True, ondelete="RESTRICT")
|
||||||
name = fields.Char(
|
name = fields.Char(
|
||||||
string='Name', required=True, states=STATES, depends=DEPENDS)
|
string='Name', required=True, states=STATES, depends=DEPENDS)
|
||||||
description = fields.Text(
|
description = fields.Text(
|
||||||
string='Description', states=STATES, depends=DEPENDS)
|
string='Description', states=STATES, depends=DEPENDS)
|
||||||
btype = fields.Many2One(
|
btype = fields.Many2One(
|
||||||
string='Type', select=True,
|
string='Type',
|
||||||
help='A cash book with type can contain postings. ' +
|
help='A cash book with type can contain postings. ' +
|
||||||
'Without type is a view.',
|
'Without type is a view.',
|
||||||
model_name='cashbook.type', ondelete='RESTRICT',
|
model_name='cashbook.type', ondelete='RESTRICT',
|
||||||
|
@ -68,16 +69,16 @@ class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
||||||
string='Feature', readonly=True,
|
string='Feature', readonly=True,
|
||||||
states={'invisible': True}), 'on_change_with_feature')
|
states={'invisible': True}), 'on_change_with_feature')
|
||||||
owner = fields.Many2One(
|
owner = fields.Many2One(
|
||||||
string='Owner', required=True, select=True,
|
string='Owner', required=True,
|
||||||
model_name='res.user', ondelete='SET NULL',
|
model_name='res.user', ondelete='SET NULL',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
reviewer = fields.Many2One(
|
reviewer = fields.Many2One(
|
||||||
string='Reviewer', select=True,
|
string='Reviewer',
|
||||||
help='Group of users who have write access to the cashbook.',
|
help='Group of users who have write access to the cashbook.',
|
||||||
model_name='res.group', ondelete='SET NULL',
|
model_name='res.group', ondelete='SET NULL',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
observer = fields.Many2One(
|
observer = fields.Many2One(
|
||||||
string='Observer', select=True,
|
string='Observer',
|
||||||
help='Group of users who have read-only access to the cashbook.',
|
help='Group of users who have read-only access to the cashbook.',
|
||||||
model_name='res.group', ondelete='SET NULL',
|
model_name='res.group', ondelete='SET NULL',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
|
@ -152,7 +153,7 @@ class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
||||||
'on_change_with_currency_digits')
|
'on_change_with_currency_digits')
|
||||||
|
|
||||||
currency = fields.Many2One(
|
currency = fields.Many2One(
|
||||||
string='Currency', select=True,
|
string='Currency',
|
||||||
model_name='currency.currency',
|
model_name='currency.currency',
|
||||||
states={
|
states={
|
||||||
'readonly': Or(
|
'readonly': Or(
|
||||||
|
@ -189,6 +190,29 @@ class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
||||||
cls._order.insert(0, ('rec_name', 'ASC'))
|
cls._order.insert(0, ('rec_name', 'ASC'))
|
||||||
cls._order.insert(0, ('state', 'ASC'))
|
cls._order.insert(0, ('state', 'ASC'))
|
||||||
t = cls.__table__()
|
t = cls.__table__()
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.btype, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.company, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.currency, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.state, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.owner, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.reviewer, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.observer, Index.Equality())),
|
||||||
|
})
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('state_val',
|
('state_val',
|
||||||
Check(t, t.state.in_(['open', 'closed', 'archive'])),
|
Check(t, t.state.in_(['open', 'closed', 'archive'])),
|
||||||
|
|
2
book.xml
2
book.xml
|
@ -121,7 +121,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_book_rw_owner-1">
|
<record model="ir.rule" id="rg_book_rw_owner-1">
|
||||||
<field name="domain" eval="[
|
<field name="domain" eval="[
|
||||||
('owner.id', '=', Eval('user', {}).get('id', -1)),
|
('owner.id', '=', Eval('user_id', -1)),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_book_rw_owner"/>
|
<field name="rule_group" ref="rg_book_rw_owner"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
24
ir.py
Normal file
24
ir.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- 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.book',
|
||||||
|
'cashbook.line',
|
||||||
|
'cashbook.recon',
|
||||||
|
'cashbook.split'
|
||||||
|
}
|
||||||
|
|
||||||
|
# end Rule
|
39
line.py
39
line.py
|
@ -3,7 +3,7 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import ModelView, ModelSQL, Workflow, fields, Check
|
from trytond.model import ModelView, ModelSQL, Workflow, fields, Check, Index
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.pyson import Eval, If, Or, Bool, Date
|
from trytond.pyson import Eval, If, Or, Bool, Date
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
@ -54,24 +54,24 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
__name__ = 'cashbook.line'
|
__name__ = 'cashbook.line'
|
||||||
|
|
||||||
cashbook = fields.Many2One(
|
cashbook = fields.Many2One(
|
||||||
string='Cashbook', required=True, select=True,
|
string='Cashbook', required=True,
|
||||||
model_name='cashbook.book', ondelete='CASCADE', readonly=True,
|
model_name='cashbook.book', ondelete='CASCADE', readonly=True,
|
||||||
domain=[('btype', '!=', None)])
|
domain=[('btype', '!=', None)])
|
||||||
date = fields.Date(
|
date = fields.Date(
|
||||||
string='Date', required=True, select=True,
|
string='Date', required=True,
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
month = fields.Function(fields.Integer(
|
month = fields.Function(fields.Integer(
|
||||||
string='Month', readonly=True),
|
string='Month', readonly=True),
|
||||||
'on_change_with_month', searcher='search_month')
|
'on_change_with_month', searcher='search_month')
|
||||||
number = fields.Char(string='Number', readonly=True)
|
number = fields.Char(string='Number', readonly=True)
|
||||||
description = fields.Text(
|
description = fields.Text(
|
||||||
string='Description', select=True,
|
string='Description',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
descr_short = fields.Function(fields.Char(
|
descr_short = fields.Function(fields.Char(
|
||||||
string='Description', readonly=True),
|
string='Description', readonly=True),
|
||||||
'on_change_with_descr_short', searcher='search_descr_short')
|
'on_change_with_descr_short', searcher='search_descr_short')
|
||||||
category = fields.Many2One(
|
category = fields.Many2One(
|
||||||
string='Category', select=True,
|
string='Category',
|
||||||
model_name='cashbook.category', ondelete='RESTRICT',
|
model_name='cashbook.category', ondelete='RESTRICT',
|
||||||
states={
|
states={
|
||||||
'readonly': Or(
|
'readonly': Or(
|
||||||
|
@ -98,7 +98,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
bookingtype = fields.Selection(
|
bookingtype = fields.Selection(
|
||||||
string='Type', required=True,
|
string='Type', required=True,
|
||||||
help='Type of Booking', selection=sel_bookingtype, select=True,
|
help='Type of Booking', selection=sel_bookingtype,
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
bookingtype_string = bookingtype.translated('bookingtype')
|
bookingtype_string = bookingtype.translated('bookingtype')
|
||||||
amount = fields.Numeric(
|
amount = fields.Numeric(
|
||||||
|
@ -145,7 +145,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
# link to lines created by this record
|
# link to lines created by this record
|
||||||
reference = fields.Many2One(
|
reference = fields.Many2One(
|
||||||
string='Reference', readonly=True, select=True,
|
string='Reference', readonly=True,
|
||||||
states={
|
states={
|
||||||
'invisible': ~Bool(Eval('reference')),
|
'invisible': ~Bool(Eval('reference')),
|
||||||
}, model_name='cashbook.line', ondelete='CASCADE',
|
}, model_name='cashbook.line', ondelete='CASCADE',
|
||||||
|
@ -198,7 +198,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
state = fields.Selection(
|
state = fields.Selection(
|
||||||
string='State', required=True, readonly=True,
|
string='State', required=True, readonly=True,
|
||||||
select=True, selection=sel_linestate)
|
selection=sel_linestate)
|
||||||
state_string = state.translated('state')
|
state_string = state.translated('state')
|
||||||
state_cashbook = fields.Function(fields.Selection(
|
state_cashbook = fields.Function(fields.Selection(
|
||||||
string='State of Cashbook',
|
string='State of Cashbook',
|
||||||
|
@ -224,6 +224,27 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
cls._order.insert(0, ('date', 'ASC'))
|
cls._order.insert(0, ('date', 'ASC'))
|
||||||
cls._order.insert(0, ('state', 'ASC'))
|
cls._order.insert(0, ('state', 'ASC'))
|
||||||
t = cls.__table__()
|
t = cls.__table__()
|
||||||
|
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.date, Index.Range(order='ASC'))),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.description, Index.Similarity())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.category, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.bookingtype, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.state, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.reference, Index.Equality())),
|
||||||
|
})
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('state_val2',
|
('state_val2',
|
||||||
Check(t, t.state.in_(['edit', 'check', 'done', 'recon'])),
|
Check(t, t.state.in_(['edit', 'check', 'done', 'recon'])),
|
||||||
|
@ -658,7 +679,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
@fields.depends('category')
|
@fields.depends('category')
|
||||||
def on_change_with_category_view(self, name=None):
|
def on_change_with_category_view(self, name=None):
|
||||||
""" show optimizef form of category for list-view
|
""" show optimized form of category for list-view
|
||||||
"""
|
"""
|
||||||
Configuration = Pool().get('cashbook.configuration')
|
Configuration = Pool().get('cashbook.configuration')
|
||||||
|
|
||||||
|
|
2
line.xml
2
line.xml
|
@ -145,7 +145,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_line_write-1">
|
<record model="ir.rule" id="rg_line_write-1">
|
||||||
<field name="domain" eval="['OR',
|
<field name="domain" eval="['OR',
|
||||||
('cashbook.owner.id', '=', Eval('user', {}).get('id', -1)),
|
('cashbook.owner.id', '=', Eval('user_id', -1)),
|
||||||
('cashbook.reviewer.id', 'in', Eval('groups', [])),
|
('cashbook.reviewer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_line_write"/>
|
<field name="rule_group" ref="rg_line_write"/>
|
||||||
|
|
12
locale/de.po
12
locale/de.po
|
@ -466,10 +466,6 @@ msgctxt "view:cashbook.book:"
|
||||||
msgid "Amount and Numbering"
|
msgid "Amount and Numbering"
|
||||||
msgstr "Betrag und Nummerierung"
|
msgstr "Betrag und Nummerierung"
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
|
||||||
msgid "Balance"
|
|
||||||
msgstr "Saldo"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
msgctxt "view:cashbook.book:"
|
||||||
msgid "Reconciliations"
|
msgid "Reconciliations"
|
||||||
msgstr "Abstimmungen"
|
msgstr "Abstimmungen"
|
||||||
|
@ -794,14 +790,6 @@ msgctxt "model:cashbook.line,name:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Kassenbuchzeile"
|
msgstr "Kassenbuchzeile"
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Credit"
|
|
||||||
msgstr "Einnahme"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Debit"
|
|
||||||
msgstr "Ausgabe"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
msgctxt "view:cashbook.line:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Kassenbuchzeile"
|
msgstr "Kassenbuchzeile"
|
||||||
|
|
12
locale/en.po
12
locale/en.po
|
@ -426,10 +426,6 @@ msgctxt "view:cashbook.book:"
|
||||||
msgid "Amount and Numbering"
|
msgid "Amount and Numbering"
|
||||||
msgstr "Amount and Numbering"
|
msgstr "Amount and Numbering"
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
|
||||||
msgid "Balance"
|
|
||||||
msgstr "Balance"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
msgctxt "view:cashbook.book:"
|
||||||
msgid "Reconciliations"
|
msgid "Reconciliations"
|
||||||
msgstr "Reconciliations"
|
msgstr "Reconciliations"
|
||||||
|
@ -746,14 +742,6 @@ msgctxt "model:cashbook.line,name:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Cashbook Line"
|
msgstr "Cashbook Line"
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Credit"
|
|
||||||
msgstr "Credit"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Debit"
|
|
||||||
msgstr "Debit"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
msgctxt "view:cashbook.line:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Cashbook Line"
|
msgstr "Cashbook Line"
|
||||||
|
|
10
model.py
10
model.py
|
@ -3,7 +3,8 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import MultiValueMixin, ValueMixin, fields, Unique, Model
|
from trytond.model import (
|
||||||
|
MultiValueMixin, ValueMixin, fields, Unique, Index)
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from sql import With
|
from sql import With
|
||||||
|
@ -122,12 +123,17 @@ def order_name_hierarchical(model_name, tables):
|
||||||
class UserValueMixin(ValueMixin):
|
class UserValueMixin(ValueMixin):
|
||||||
iduser = fields.Many2One(
|
iduser = fields.Many2One(
|
||||||
model_name='res.user', string="User",
|
model_name='res.user', string="User",
|
||||||
select=True, ondelete='CASCADE', required=True)
|
ondelete='CASCADE', required=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(UserValueMixin, cls).__setup__()
|
super(UserValueMixin, cls).__setup__()
|
||||||
tab_val = cls.__table__()
|
tab_val = cls.__table__()
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
tab_val,
|
||||||
|
(tab_val.iduser, Index.Equality())),
|
||||||
|
})
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('val_uniq',
|
('val_uniq',
|
||||||
Unique(tab_val, tab_val.iduser),
|
Unique(tab_val, tab_val.iduser),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import Workflow, ModelView, ModelSQL, fields
|
from trytond.model import Workflow, ModelView, ModelSQL, fields, Index
|
||||||
from trytond.pyson import Eval, If, Or
|
from trytond.pyson import Eval, If, Or
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
|
@ -34,10 +34,10 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
__name__ = 'cashbook.recon'
|
__name__ = 'cashbook.recon'
|
||||||
|
|
||||||
cashbook = fields.Many2One(
|
cashbook = fields.Many2One(
|
||||||
string='Cashbook', required=True, select=True,
|
string='Cashbook', required=True,
|
||||||
model_name='cashbook.book', ondelete='CASCADE', readonly=True)
|
model_name='cashbook.book', ondelete='CASCADE', readonly=True)
|
||||||
date = fields.Date(
|
date = fields.Date(
|
||||||
string='Date', required=True, select=True,
|
string='Date', required=True,
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
feature = fields.Function(fields.Char(
|
feature = fields.Function(fields.Char(
|
||||||
string='Feature', readonly=True,
|
string='Feature', readonly=True,
|
||||||
|
@ -54,7 +54,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
states=STATES, depends=DEPENDS+['date_to'])
|
states=STATES, depends=DEPENDS+['date_to'])
|
||||||
date_to = fields.Date(
|
date_to = fields.Date(
|
||||||
string='End Date',
|
string='End Date',
|
||||||
required=True, select=True,
|
required=True,
|
||||||
domain=[
|
domain=[
|
||||||
If(Eval('date_to') & Eval('date_from'),
|
If(Eval('date_to') & Eval('date_from'),
|
||||||
('date_from', '<=', Eval('date_to')),
|
('date_from', '<=', Eval('date_to')),
|
||||||
|
@ -98,7 +98,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
state = fields.Selection(
|
state = fields.Selection(
|
||||||
string='State', required=True, readonly=True,
|
string='State', required=True, readonly=True,
|
||||||
select=True, selection=sel_reconstate)
|
selection=sel_reconstate)
|
||||||
state_string = state.translated('state')
|
state_string = state.translated('state')
|
||||||
state_cashbook = fields.Function(fields.Selection(
|
state_cashbook = fields.Function(fields.Selection(
|
||||||
string='State of Cashbook',
|
string='State of Cashbook',
|
||||||
|
@ -109,6 +109,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(Reconciliation, cls).__setup__()
|
super(Reconciliation, cls).__setup__()
|
||||||
cls._order.insert(0, ('date_from', 'DESC'))
|
cls._order.insert(0, ('date_from', 'DESC'))
|
||||||
|
t = cls.__table__()
|
||||||
cls._transitions |= set((
|
cls._transitions |= set((
|
||||||
('edit', 'check'),
|
('edit', 'check'),
|
||||||
('check', 'done'),
|
('check', 'done'),
|
||||||
|
@ -128,6 +129,23 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
'depends': ['state'],
|
'depends': ['state'],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.cashbook, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.date, Index.Range())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.date_to, Index.Range())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.date_from, Index.Range(order='DESC'))),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.state, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
def check_overlap_dates(self):
|
def check_overlap_dates(self):
|
||||||
""" deny overlap of date_from/date_to between records of same cashbook
|
""" deny overlap of date_from/date_to between records of same cashbook
|
||||||
|
|
|
@ -96,7 +96,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_recon_write-1">
|
<record model="ir.rule" id="rg_recon_write-1">
|
||||||
<field name="domain" eval="['OR',
|
<field name="domain" eval="['OR',
|
||||||
('cashbook.owner.id', '=', Eval('user', {}).get('id', -1)),
|
('cashbook.owner.id', '=', Eval('user_id', -1)),
|
||||||
('cashbook.reviewer.id', 'in', Eval('groups', [])),
|
('cashbook.reviewer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_recon_write"/>
|
<field name="rule_group" ref="rg_recon_write"/>
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -39,7 +39,7 @@ with open(path.join(here, 'versiondep.txt'), encoding='utf-8') as f:
|
||||||
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
|
# tryton-version
|
||||||
major_version = 6
|
major_version = 7
|
||||||
minor_version = 0
|
minor_version = 0
|
||||||
|
|
||||||
requires = ['python-slugify']
|
requires = ['python-slugify']
|
||||||
|
@ -91,6 +91,7 @@ setup(
|
||||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||||
'Programming Language :: Python :: 3.7',
|
'Programming Language :: Python :: 3.7',
|
||||||
'Programming Language :: Python :: 3.8',
|
'Programming Language :: Python :: 3.8',
|
||||||
|
'Programming Language :: Python :: 3.9',
|
||||||
],
|
],
|
||||||
|
|
||||||
keywords='tryton cashbook',
|
keywords='tryton cashbook',
|
||||||
|
|
29
splitline.py
29
splitline.py
|
@ -4,7 +4,7 @@
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
|
||||||
from trytond.model import ModelView, ModelSQL, fields
|
from trytond.model import ModelView, ModelSQL, fields, Index
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.pyson import Eval, If
|
from trytond.pyson import Eval, If
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
|
@ -31,16 +31,16 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
|
||||||
|
|
||||||
line = fields.Many2One(
|
line = fields.Many2One(
|
||||||
string='Line', required=True,
|
string='Line', required=True,
|
||||||
select=True, ondelete='CASCADE', model_name='cashbook.line',
|
ondelete='CASCADE', model_name='cashbook.line',
|
||||||
readonly=True)
|
readonly=True)
|
||||||
description = fields.Text(
|
description = fields.Text(
|
||||||
string='Description', states=STATES, depends=DEPENDS)
|
string='Description', states=STATES, depends=DEPENDS)
|
||||||
splittype = fields.Selection(
|
splittype = fields.Selection(
|
||||||
string='Type', required=True,
|
string='Type', required=True,
|
||||||
help='Type of split booking line', selection=sel_linetype,
|
help='Type of split booking line', selection=sel_linetype,
|
||||||
states=STATES, depends=DEPENDS, select=True)
|
states=STATES, depends=DEPENDS)
|
||||||
category = fields.Many2One(
|
category = fields.Many2One(
|
||||||
string='Category', select=True,
|
string='Category',
|
||||||
model_name='cashbook.category', ondelete='RESTRICT',
|
model_name='cashbook.category', ondelete='RESTRICT',
|
||||||
states={
|
states={
|
||||||
'readonly': STATES['readonly'],
|
'readonly': STATES['readonly'],
|
||||||
|
@ -63,7 +63,7 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
|
||||||
('owner.id', '=', Eval('owner_cashbook', -1)),
|
('owner.id', '=', Eval('owner_cashbook', -1)),
|
||||||
('id', '!=', Eval('cashbook', -1)),
|
('id', '!=', Eval('cashbook', -1)),
|
||||||
('btype', '!=', None),
|
('btype', '!=', None),
|
||||||
], select=True,
|
],
|
||||||
states={
|
states={
|
||||||
'readonly': STATES['readonly'],
|
'readonly': STATES['readonly'],
|
||||||
'invisible': Eval('splittype', '') != 'tr',
|
'invisible': Eval('splittype', '') != 'tr',
|
||||||
|
@ -110,6 +110,25 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
|
||||||
states={'invisible': True}, model_name='res.user'),
|
states={'invisible': True}, model_name='res.user'),
|
||||||
'on_change_with_owner_cashbook')
|
'on_change_with_owner_cashbook')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __setup__(cls):
|
||||||
|
super(SplitLine, cls).__setup__()
|
||||||
|
t = cls.__table__()
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.line, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.splittype, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.category, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.booktransf, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_splittype(cls):
|
def default_splittype(cls):
|
||||||
""" default category
|
""" default category
|
||||||
|
|
|
@ -80,7 +80,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_split_write-1">
|
<record model="ir.rule" id="rg_split_write-1">
|
||||||
<field name="domain" eval="['OR',
|
<field name="domain" eval="['OR',
|
||||||
('line.cashbook.owner.id', '=', Eval('user', {}).get('id', -1)),
|
('line.cashbook.owner.id', '=', Eval('user_id', -1)),
|
||||||
('line.cashbook.reviewer.id', 'in', Eval('groups', [])),
|
('line.cashbook.reviewer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_split_write"/>
|
<field name="rule_group" ref="rg_split_write"/>
|
||||||
|
|
|
@ -1,16 +1,4 @@
|
||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# -*- coding: utf-8 -*-
|
||||||
# this repository contains the full copyright notices and license terms.
|
# 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
|
||||||
import trytond.tests.test_tryton
|
# full copyright notices and license terms.
|
||||||
import unittest
|
|
||||||
|
|
||||||
from .test_module import CashbookTestCase
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['suite']
|
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
|
||||||
suite = trytond.tests.test_tryton.suite()
|
|
||||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(CashbookTestCase))
|
|
||||||
return suite
|
|
||||||
|
|
|
@ -119,8 +119,8 @@ class CategoryTestCase(object):
|
||||||
|
|
||||||
self.assertRaisesRegex(
|
self.assertRaisesRegex(
|
||||||
UserError,
|
UserError,
|
||||||
'The value for field "Type" in "Category" is not valid ' +
|
'The value "out" for field "Type" in "Level 1/Level 2" of ' +
|
||||||
'according to its domain.',
|
'"Category" is not valid according to its domain.',
|
||||||
Category.write,
|
Category.write,
|
||||||
*[
|
*[
|
||||||
[category.childs[0]],
|
[category.childs[0]],
|
||||||
|
|
|
@ -895,8 +895,8 @@ class LineTestCase(object):
|
||||||
|
|
||||||
self.assertRaisesRegex(
|
self.assertRaisesRegex(
|
||||||
UserError,
|
UserError,
|
||||||
'The value for field "Cashbook" in "Cashbook Line" is not ' +
|
r'The value "Book 1" for field "Cashbook" in "\d+" of ' +
|
||||||
'valid according to its domain.',
|
r'"Cashbook Line" is not valid according to its domain.',
|
||||||
Line.create,
|
Line.create,
|
||||||
[{
|
[{
|
||||||
'cashbook': book.id,
|
'cashbook': book.id,
|
||||||
|
|
|
@ -267,10 +267,10 @@ class ValuestoreTestCase(object):
|
||||||
# check write of too much digits
|
# check write of too much digits
|
||||||
self.assertRaisesRegex(
|
self.assertRaisesRegex(
|
||||||
UserError,
|
UserError,
|
||||||
r"The number of digits in the value " +
|
r'The number of digits in the value ' +
|
||||||
r'"Decimal\(' +
|
r'"' + r"'12.345'" +
|
||||||
r"'12\.345'\)" +
|
r'" for field "Value" in "[Book 1 | 10\.00 usd | ' +
|
||||||
r'" for field "Value" in "Value Store" exceeds ' +
|
r'Open]|balance|12\.35|2" of "Value Store" exceeds ' +
|
||||||
r'the limit of "2".',
|
r'the limit of "2".',
|
||||||
ValueStore.write,
|
ValueStore.write,
|
||||||
*[
|
*[
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=6.0.35
|
version=7.0.0
|
||||||
depends:
|
depends:
|
||||||
res
|
res
|
||||||
currency
|
currency
|
||||||
party
|
party
|
||||||
company
|
company
|
||||||
|
irrulecontext
|
||||||
xml:
|
xml:
|
||||||
icon.xml
|
icon.xml
|
||||||
group.xml
|
group.xml
|
||||||
|
|
9
types.py
9
types.py
|
@ -3,7 +3,7 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import ModelView, ModelSQL, fields, Unique
|
from trytond.model import ModelView, ModelSQL, fields, Unique, Index
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class Type(ModelSQL, ModelView):
|
||||||
required=True, ondelete="RESTRICT")
|
required=True, ondelete="RESTRICT")
|
||||||
feature = fields.Selection(
|
feature = fields.Selection(
|
||||||
string='Feature', required=True,
|
string='Feature', required=True,
|
||||||
selection='get_sel_feature', select=True,
|
selection='get_sel_feature',
|
||||||
help='Select feature set of the Cashbook.')
|
help='Select feature set of the Cashbook.')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -32,6 +32,11 @@ class Type(ModelSQL, ModelView):
|
||||||
Unique(t, t.short),
|
Unique(t, t.short),
|
||||||
'cashbook.msg_type_short_unique'),
|
'cashbook.msg_type_short_unique'),
|
||||||
])
|
])
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.feature, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_feature(cls):
|
def default_feature(cls):
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
from sql.functions import CurrentTimestamp, DateTrunc
|
from sql.functions import CurrentTimestamp, DateTrunc
|
||||||
from sql.aggregate import Count
|
from sql.aggregate import Count
|
||||||
from sql.conditionals import Coalesce
|
from sql.conditionals import Coalesce
|
||||||
from trytond.model import ModelSQL, fields, Unique
|
from trytond.model import ModelSQL, fields, Unique, Index
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pyson import Eval, PYSON, PYSONEncoder, PYSONDecoder
|
from trytond.pyson import Eval, PYSON, PYSONEncoder, PYSONDecoder
|
||||||
|
@ -22,7 +22,7 @@ class ValueStore(ModelSQL):
|
||||||
cashbook = fields.Many2One(
|
cashbook = fields.Many2One(
|
||||||
string='Cashbook', required=True, model_name='cashbook.book',
|
string='Cashbook', required=True, model_name='cashbook.book',
|
||||||
ondelete='CASCADE')
|
ondelete='CASCADE')
|
||||||
field_name = fields.Char(string='Field Name', required=True, select=True)
|
field_name = fields.Char(string='Field Name', required=True)
|
||||||
numvalue = fields.Numeric(
|
numvalue = fields.Numeric(
|
||||||
string='Value', digits=(16, Eval('valuedigits', 6)),
|
string='Value', digits=(16, Eval('valuedigits', 6)),
|
||||||
depends=['valuedigits'])
|
depends=['valuedigits'])
|
||||||
|
@ -49,6 +49,11 @@ class ValueStore(ModelSQL):
|
||||||
Unique(t, t.cashbook, t.field_name),
|
Unique(t, t.cashbook, t.field_name),
|
||||||
'cashbook.msg_value_exists_in_store'),
|
'cashbook.msg_value_exists_in_store'),
|
||||||
])
|
])
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.field_name, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
""" name, balance, state
|
""" name, balance, state
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
|
irrulecontext;7.0.1;7.0.999;mds
|
||||||
|
|
|
@ -4,6 +4,8 @@ The COPYRIGHT file at the top level of this repository contains the
|
||||||
full copyright notices and license terms. -->
|
full copyright notices and license terms. -->
|
||||||
<tree keyword_open="1">
|
<tree keyword_open="1">
|
||||||
<field name="rec_name" expand="1"/>
|
<field name="rec_name" expand="1"/>
|
||||||
<field name="balance" sum="Balance" symbol="currency"/>
|
<field name="balance" sum="1" symbol="currency"/>
|
||||||
<field name="state"/>
|
<field name="balance_all" symbol="currency" optional="1"/>
|
||||||
|
<field name="balance_ref" symbol="company_currency" optional="1"/>
|
||||||
|
<field name="state" optional="0"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -5,7 +5,9 @@ full copyright notices and license terms. -->
|
||||||
<tree keyword_open="1" tree_state="1">
|
<tree keyword_open="1" tree_state="1">
|
||||||
<field name="name" expand="1"/>
|
<field name="name" expand="1"/>
|
||||||
<field name="balance" symbol="currency"/>
|
<field name="balance" symbol="currency"/>
|
||||||
<field name="state"/>
|
<field name="balance_all" symbol="currency" optional="1"/>
|
||||||
|
<field name="balance_ref" symbol="company_currency" optional="1"/>
|
||||||
|
<field name="state" optional="0"/>
|
||||||
<field name="parent" tree_invisible="1"/>
|
<field name="parent" tree_invisible="1"/>
|
||||||
<field name="childs" tree_invisible="1"/>
|
<field name="childs" tree_invisible="1"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -4,14 +4,14 @@ The COPYRIGHT file at the top level of this repository contains the
|
||||||
full copyright notices and license terms. -->
|
full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="cashbook" tree_invisible="1"/>
|
<field name="cashbook" tree_invisible="1"/>
|
||||||
<field name="number"/>
|
<field name="number" optional="0"/>
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field name="payee"/>
|
<field name="payee"/>
|
||||||
<field name="category_view"/>
|
<field name="category_view"/>
|
||||||
<field name="descr_short" expand="1"/>
|
<field name="descr_short" expand="1"/>
|
||||||
<field name="credit" sum="Credit"/>
|
<field name="credit" sum="1" optional="0"/>
|
||||||
<field name="debit" sum="Debit"/>
|
<field name="debit" sum="1" optional="0"/>
|
||||||
<field name="balance"/>
|
<field name="balance" optional="0"/>
|
||||||
<field name="state"/>
|
<field name="state" optional="0"/>
|
||||||
<button name="wfcheck"/>
|
<button name="wfcheck"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -4,13 +4,13 @@ The COPYRIGHT file at the top level of this repository contains the
|
||||||
full copyright notices and license terms. -->
|
full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="cashbook" tree_invisible="1"/>
|
<field name="cashbook" tree_invisible="1"/>
|
||||||
<field name="number"/>
|
<field name="number" optional="0"/>
|
||||||
<field name="date"/>
|
<field name="date" optional="0"/>
|
||||||
<field name="payee"/>
|
<field name="payee" optional="0"/>
|
||||||
<field name="category_view"/>
|
<field name="category_view" optional="0"/>
|
||||||
<field name="descr_short" expand="1"/>
|
<field name="descr_short" expand="1" optional="0"/>
|
||||||
<field name="credit" sum="Credit"/>
|
<field name="credit" sum="1" optional="0"/>
|
||||||
<field name="debit" sum="Debit"/>
|
<field name="debit" sum="1" optional="0"/>
|
||||||
<field name="state"/>
|
<field name="state" optional="0"/>
|
||||||
<button name="wfrecon"/>
|
<button name="wfrecon"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -4,11 +4,11 @@ The COPYRIGHT file at the top level of this repository contains the
|
||||||
full copyright notices and license terms. -->
|
full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="cashbook"/>
|
<field name="cashbook"/>
|
||||||
<field name="date"/>
|
<field name="date" optional="0"/>
|
||||||
<field name="date_from"/>
|
<field name="date_from" optional="0"/>
|
||||||
<field name="date_to"/>
|
<field name="date_to" optional="0"/>
|
||||||
<field name="start_amount"/>
|
<field name="start_amount" optional="0"/>
|
||||||
<field name="end_amount"/>
|
<field name="end_amount" optional="0"/>
|
||||||
<field name="lines"/>
|
<field name="lines" optional="0"/>
|
||||||
<field name="state"/>
|
<field name="state" optional="0"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -8,7 +8,7 @@ full copyright notices and license terms. -->
|
||||||
<field name="splittype"/>
|
<field name="splittype"/>
|
||||||
<field name="category"/>
|
<field name="category"/>
|
||||||
<field name="booktransf"/>
|
<field name="booktransf"/>
|
||||||
<field name="description" expand="1"/>
|
<field name="description" expand="1" optional="0"/>
|
||||||
<field name="amount" sum="Amount" symbol="currency"/>
|
<field name="amount" sum="1" symbol="currency" optional="0"/>
|
||||||
<field name="amount_2nd_currency" symbol="currency2nd"/>
|
<field name="amount_2nd_currency" symbol="currency2nd" optional="0"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
Loading…
Reference in a new issue