Compare commits

...

32 commits

Author SHA1 Message Date
Frederik Jaeckel
e64ca69e42 Version 6.0.8 2023-12-06 22:28:35 +01:00
Frederik Jaeckel
1f0c3c1e50 formatting 2023-12-03 17:56:46 +01:00
Frederik Jaeckel
3c964a7d51 fix: exception if no bookings in cashbook used for evaluation 2023-06-28 13:41:10 +02:00
Frederik Jaeckel
d3407fd1c7 formatting 2023-06-16 14:15:57 +02:00
Frederik Jaeckel
a98b408cfa readme 2023-03-13 09:25:48 +01:00
Frederik Jaeckel
5744f46d65 Etikett ver 6.0.7 zum Änderungssatz 4b9332867228 hinzugefügt 2023-03-11 08:24:27 +01:00
Frederik Jaeckel
ad3e1219f3 Version 6.0.7 2023-03-11 08:24:19 +01:00
Frederik Jaeckel
fd1874d5f0 add translations 2023-03-11 08:19:48 +01:00
Frederik Jaeckel
7ccedc2592 add tests 2023-03-10 23:44:02 +01:00
Frederik Jaeckel
dcf2f83212 report: add totla-yield, tests todo 2023-03-10 16:45:50 +01:00
Frederik Jaeckel
01ef7d4161 setup.py 2023-02-14 11:24:34 +01:00
Frederik Jaeckel
152f0cceeb Etikett ver 6.0.6 zum Änderungssatz bd93539bf587 hinzugefügt 2023-02-06 20:24:06 +01:00
Frederik Jaeckel
991db732bc Version 6.0.6 2023-02-06 20:23:59 +01:00
Frederik Jaeckel
b847d64187 add profit/loss-values for selection of cashbooks by btype 2023-02-06 20:22:07 +01:00
Frederik Jaeckel
a71f05b1da Etikett ver 6.0.5 zum Änderungssatz b2625d3504ac hinzugefügt 2023-02-06 09:33:33 +01:00
Frederik Jaeckel
081be8392b Version 6.0.5 2023-02-06 09:33:24 +01:00
Frederik Jaeckel
4ab46071a3 fix: evaluation cashbook-currentvalue/diff return 'balance' on non-asset-cashbooks 2023-02-06 09:32:01 +01:00
Frederik Jaeckel
3c4f2ea47b Etikett ver 6.0.4 zum Änderungssatz 61085fa941bc hinzugefügt 2023-02-05 18:20:44 +01:00
Frederik Jaeckel
8db7bcf376 Version 6.0.4 2023-02-05 18:20:36 +01:00
Frederik Jaeckel
e3a41b821b convert results to evaluation-currency, fix states 2023-02-05 18:16:49 +01:00
Frederik Jaeckel
0c3a130ef5 evaluation: extend categories-diff/percent/value + tests 2023-02-05 14:39:00 +01:00
Frederik Jaeckel
9774f183ad extend evaluation for cashbook-profit/loss amount/percent/diff - todo 2023-02-02 23:35:58 +01:00
Frederik Jaeckel
6ee40e8cff Etikett ver 6.0.3 zum Änderungssatz b738f8a6caa2 hinzugefügt 2022-11-08 22:03:34 +01:00
Frederik Jaeckel
d5bc461cd6 Version 6.0.3 2022-11-08 22:03:24 +01:00
Frederik Jaeckel
b6c30a10df Kassenbuchkategorie eingebunden + Test 2022-11-08 21:56:03 +01:00
Frederik Jaeckel
d774fa2e20 line: beachtet nur buchungen bis zum aktuellen tag 2022-11-07 08:57:39 +01:00
Frederik Jaeckel
f06eacbadc auswertung: dashboard-window aktualisieren bei änderung der auswertung 2022-11-06 15:40:23 +01:00
Frederik Jaeckel
c0432d609d Etikett ver 6.0.2 zum Änderungssatz 03b7ae6ac62e hinzugefügt 2022-11-05 21:55:48 +01:00
Frederik Jaeckel
1009d0077e Version 6.0.2 2022-11-05 21:55:36 +01:00
Frederik Jaeckel
81c1624d97 auswertung: sequence-sortierung,
line: zugriff auf buchungen nur noch per berechtigungen
2022-11-05 21:43:28 +01:00
Frederik Jaeckel
80fbb5d722 Etikett ver 6.0.1 zum Änderungssatz 1c6bf7847073 hinzugefügt 2022-11-05 13:57:38 +01:00
Frederik Jaeckel
ceaeb67cd7 Version 6.0.1 2022-11-05 13:57:29 +01:00
19 changed files with 1642 additions and 365 deletions

View file

@ -11,9 +11,59 @@ Requires
========
- Tryton 6.0
Info
====
Module cashbook_report adds the following evaluations:
- account balance as amount,
- price difference according to stock exchange price as amount,
- exchange rate difference in percent,
- current value according to stock exchange price,
- total yield
The displayed data is selected according to cash books,
types of cash books and cash books by category.
The presentation can be done as pie, bar and line chart.
For each evaluation, a dashboard view is also created,
so that you can display several evaluations at the same time.
Changes
=======
*6.0.8 - 06.12.2023*
- optimized code
*6.0.7 - 11.03.2023*
- add: type of evaluation 'total yield' for cashbook/type/category
*6.0.6 - 06.02.2023*
- add: profit/loss-values for btype-selection of cashbooks
*6.0.5 - 06.02.2023*
- fix: values on non-asset-cashbooks
*6.0.4 - 05.02.2023*
- add: investment to evaluation-types
*6.0.3 - 08.11.2022*
- add: cashbook-categories for evaluation
- updt: optimized update of evaluation with existing dashboard-actions
- updt: limit bookings in evaluation-result to today
*6.0.2 - 05.11.2022*
- evaluation-line: permissions optimized
- evaluation: sorting by sequence
*6.0.1 - 05.11.2022*
- works
*6.0.0 - 28.10.2022*
- init

View file

@ -9,6 +9,8 @@ from .line import EvaluationLine
from .currency import Currency
from .evaluation_context import EvaluationContext
from .evaluation_wizard import OpenChartWizard
from .investment import InvestmentEvaluation, InvestmentLine
def register():
Pool.register(
@ -20,3 +22,9 @@ def register():
Pool.register(
OpenChartWizard,
module='cashbook_report', type_='wizard')
Pool.register(
InvestmentEvaluation,
InvestmentLine,
module='cashbook_report',
type_='model',
depends=['cashbook_investment'])

View file

@ -13,8 +13,9 @@ from sql.conditionals import Case
class Currency(metaclass=PoolMeta):
__name__ = 'currency.currency'
cashbook_hasbookings = fields.Function(fields.Boolean(string='Has Bookings',
readonly=True), 'on_change_with_cashbook_hasbookings',
cashbook_hasbookings = fields.Function(fields.Boolean(
string='Has Bookings', readonly=True),
'on_change_with_cashbook_hasbookings',
searcher='search_cashbook_hasbookings')
@fields.depends('id')
@ -24,11 +25,9 @@ class Currency(metaclass=PoolMeta):
Lines = Pool().get('cashbook.line')
with Transaction().set_context({
'_check_access': True,
}):
'_check_access': True}):
if Lines.search_count([
('cashbook.currency.id', '=', self.id),
]) > 0:
('cashbook.currency.id', '=', self.id)]) > 0:
return True
return False
@ -45,18 +44,19 @@ class Currency(metaclass=PoolMeta):
tab_line = Line.__table__()
Operator = fields.SQL_OPERATORS[clause[1]]
query = tab_book.join(tab_line,
condition=tab_book.id==tab_line.cashbook,
).join(tab_cur,
condition=tab_cur.id==tab_book.currency,
query = tab_book.join(
tab_line,
condition=tab_book.id == tab_line.cashbook,
).join(
tab_cur,
condition=tab_cur.id == tab_book.currency,
).select(
tab_cur.id,
having=Operator(Case(
(Count(tab_line.id) > 0, True),
else_ = False,
else_=False,
), clause[2]),
group_by=[tab_cur.id,],
)
group_by=[tab_cur.id])
return [('id', 'in', query)]
# end Currency

View file

@ -3,21 +3,16 @@
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields
from trytond.model import ModelView, ModelSQL, fields, sequence_ordered
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond.i18n import gettext
from .colors import sel_color as sel_bgcolor
from .templates import template_view_graph, template_view_line
from .templates import template_view_graph, template_view_line, \
cashbook_types, category_types, booktype_types
sel_etype = [
('cashbooks', 'Cashbooks'),
('types', 'Types of Cashbooks'),
('currencies', 'Currencys'),
#('category', 'Category'),
]
sel_chart = [
('vbar', 'Vertical Bars'),
('hbar', 'Horizontal Bars'),
@ -36,61 +31,68 @@ sel_maincolor = [
]
class Evaluation(ModelSQL, ModelView):
class Evaluation(sequence_ordered(), ModelSQL, ModelView):
'Evaluation'
__name__ = 'cashbook_report.evaluation'
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)
dtype = fields.Selection(string='Data type', required=True,
sort=False, selection=sel_etype,
help='Type of data displayed')
dtype = fields.Selection(
string='Data type', required=True, sort=True,
selection='get_sel_etype', help='Type of data displayed')
dtype_string = dtype.translated('dtype')
chart = fields.Selection(string='Chart type', required=True,
sort=False, selection=sel_chart,
help='Type of graphical presentation.')
chart = fields.Selection(
string='Chart type', required=True, sort=False,
selection=sel_chart, help='Type of graphical presentation.')
legend = fields.Boolean(string='Legend')
maincolor = fields.Selection(string='Color scheme', required=True,
help='The color scheme determines the hue of all components of the chart.',
selection=sel_maincolor, sort=False)
bgcolor = fields.Selection(string='Background Color', required=True,
maincolor = fields.Selection(
string='Color scheme', required=True,
help='The color scheme determines the hue of all ' +
'components of the chart.', selection=sel_maincolor, sort=False)
bgcolor = fields.Selection(
string='Background Color', required=True,
help='Background color of the chart area.', sort=False,
selection=sel_bgcolor)
posted = fields.Boolean(string='Posted', help='Posted amounts only.')
currency = fields.Many2One(string='Currency', ondelete='RESTRICT',
currency = fields.Many2One(
string='Currency', ondelete='RESTRICT',
model_name='currency.currency')
cashbooks = fields.Many2Many(string='Cashbooks',
relation_name='cashbook_report.eval_line',
cashbooks = fields.Many2Many(
string='Cashbooks', relation_name='cashbook_report.eval_line',
origin='evaluation', target='cashbook',
states={
'invisible': Eval('dtype', '') != 'cashbooks',
}, depends=['dtype'])
types = fields.Many2Many(string='Types',
relation_name='cashbook_report.eval_line',
states={'invisible': ~Eval('dtype', '').in_(cashbook_types)},
depends=['dtype'])
types = fields.Many2Many(
string='Types', relation_name='cashbook_report.eval_line',
origin='evaluation', target='dtype',
states={
'invisible': Eval('dtype', '') != 'types',
}, depends=['dtype'])
currencies = fields.Many2Many(string='Currencies',
relation_name='cashbook_report.eval_line',
states={'invisible': ~Eval('dtype', '').in_(booktype_types)},
depends=['dtype'])
currencies = fields.Many2Many(
string='Currencies', relation_name='cashbook_report.eval_line',
origin='evaluation', target='currency',
filter=[('cashbook_hasbookings', '=', True)],
states={
'invisible': Eval('dtype', '') != 'currencies',
}, depends=['dtype'])
states={'invisible': Eval('dtype', '') != 'currencies'},
depends=['dtype'])
categories = fields.Many2Many(
string='Categories', relation_name='cashbook_report.eval_line',
origin='evaluation', target='category',
states={'invisible': ~Eval('dtype', '').in_(category_types)},
depends=['dtype'])
line_values = fields.One2Many(string='Line Values',
field='evaluation', readonly=True,
line_values = fields.One2Many(
string='Line Values', field='evaluation', readonly=True,
model_name='cashbook_report.eval_line')
ui_view_chart = fields.Many2One(string='UI View Chart',
model_name='ir.ui.view', ondelete='SET NULL')
dashb_actwin = fields.Many2One(string='Dashboard Window',
model_name='ir.action.act_window', ondelete='SET NULL')
dashb_actview = fields.Many2One(string='Dashboard View',
model_name='ir.action.act_window.view', ondelete='SET NULL')
ui_view_chart = fields.Many2One(
string='UI View Chart', model_name='ir.ui.view', ondelete='SET NULL')
dashb_actwin = fields.Many2One(
string='Dashboard Window', model_name='ir.action.act_window',
ondelete='SET NULL')
dashb_actview = fields.Many2One(
string='Dashboard View', model_name='ir.action.act_window.view',
ondelete='SET NULL')
@classmethod
def default_currency(cls):
@ -108,12 +110,6 @@ class Evaluation(ModelSQL, ModelView):
def default_company():
return Transaction().context.get('company') or None
@classmethod
def default_posted(cls):
""" default: False
"""
return False
@classmethod
def default_bgcolor(cls):
""" default: Yellow 5
@ -144,6 +140,17 @@ class Evaluation(ModelSQL, ModelView):
"""
return 'pie'
@classmethod
def get_sel_etype(cls):
""" get list of evaluation-types
"""
return [
('cashbooks', gettext('cashbook_report.msg_dtype_cashbook')),
('types', gettext('cashbook_report.msg_dtype_type')),
('currencies', gettext('cashbook_report.msg_dtype_currency')),
('categories', gettext('cashbook_report.msg_dtype_category')),
]
@classmethod
def get_create_view_data(cls, evaluation):
""" generate dictionary to create view-xml
@ -154,18 +161,15 @@ class Evaluation(ModelSQL, ModelView):
'priority': 10,
'type': 'graph',
'data': template_view_graph % {
'bgcol': '' if evaluation.bgcolor == 'default' \
'bgcol': '' if evaluation.bgcolor == 'default'
else 'background="%s"' % evaluation.bgcolor,
'legend': '1' if evaluation.legend == True else '0',
'legend': '1' if evaluation.legend is True else '0',
'type': evaluation.chart,
'colscheme': '' if evaluation.maincolor == 'default' \
'colscheme': '' if evaluation.maincolor == 'default'
else 'color="%s"' % evaluation.maincolor,
'lines': template_view_line % {
'fill': '1',
'string': evaluation.dtype_string,
},
},
}
'string': evaluation.dtype_string}}}
@classmethod
def uiview_delete(cls, evaluations):
@ -184,8 +188,7 @@ class Evaluation(ModelSQL, ModelView):
to_delete_window.append(evaluation.dashb_actwin)
with Transaction().set_context({
'_check_access': False,
}):
'_check_access': False}):
if len(to_delete_uiview) > 0:
UiView.delete(to_delete_uiview)
if len(to_delete_window) > 0:
@ -200,14 +203,16 @@ class Evaluation(ModelSQL, ModelView):
ActWin = pool.get('ir.action.act_window')
ActView = pool.get('ir.action.act_window.view')
Evaluation2 = pool.get('cashbook_report.evaluation')
cls.uiview_delete(evaluations)
try:
DashboardAction = pool.get('dashboard.action')
except Exception:
DashboardAction = None
to_write_eval = []
to_write_dbaction = []
for evaluation in evaluations:
with Transaction().set_context({
'_check_access': False,
}):
'_check_access': False}):
view_graph, = UiView.create([
cls.get_create_view_data(evaluation),
])
@ -233,6 +238,24 @@ class Evaluation(ModelSQL, ModelView):
'dashb_actview': dashb_actview.id,
}])
# prepare update dasboard-action
if DashboardAction is not None:
if evaluation.dashb_actwin:
db_actions = DashboardAction.search([
('act_window.id', '=', evaluation.dashb_actwin.id),
])
if len(db_actions) > 0:
to_write_dbaction.extend([
db_actions,
{
'act_window': dashb_actwin.id,
}])
if len(to_write_dbaction) > 0:
DashboardAction.write(*to_write_dbaction)
cls.uiview_delete(evaluations)
if len(to_write_eval) > 0:
Evaluation2.write(*to_write_eval)
@ -254,8 +277,9 @@ class Evaluation(ModelSQL, ModelView):
actions = iter(args)
for evaluations, values in zip(actions, actions):
# update ui-view if related fields change
if len(set({'name', 'dtype', 'bgcolor', 'maincolor',
'legend', 'chart'}).intersection(values.keys())) > 0:
if len(set({
'name', 'dtype', 'bgcolor', 'maincolor',
'legend', 'chart'}).intersection(values.keys())) > 0:
to_update_uiview.extend(evaluations)
# unlink records if dtype changes
@ -264,33 +288,18 @@ class Evaluation(ModelSQL, ModelView):
if evaluation.dtype == values['dtype']:
continue
if (values['dtype'] != 'cashbooks') and \
(len(evaluation.cashbooks) > 0):
to_write.extend([
[evaluation],
{
'cashbooks': [
('remove', [x.id for x in evaluation.cashbooks])
],
}])
if (values['dtype'] != 'types') and (len(evaluation.types) > 0):
to_write.extend([
[evaluation],
{
'types': [
('remove', [x.id for x in evaluation.types])
],
}])
if (values['dtype'] != 'currencies') and (len(evaluation.currencies) > 0):
to_write.extend([
[evaluation],
{
'currencies': [
('remove', [x.id for x in evaluation.currencies])
],
}])
for dt in [
'cashbooks', 'types', 'currencies',
'categories']:
if (not values['dtype'].startswith(dt)) and \
(len(getattr(evaluation, dt)) > 0):
to_write.extend([
[evaluation],
{
dt: [('remove', [
x.id for x in getattr(
evaluation, dt)])],
}])
args = list(args)
args.extend(to_write)
@ -307,4 +316,3 @@ class Evaluation(ModelSQL, ModelView):
super(Evaluation, cls).delete(evaluations)
# end Evaluation

View file

@ -11,7 +11,8 @@ class EvaluationContext(ModelView):
'Evaluation Context'
__name__ = 'cashbook_report.evaluation.context'
evaluation = fields.Many2One(string='Evaluation', readonly=True,
evaluation = fields.Many2One(
string='Evaluation', readonly=True,
model_name='cashbook_report.evaluation')
@classmethod

View file

@ -28,11 +28,10 @@ class OpenChartWizard(Wizard):
if evaluation.ui_view_chart:
action['pyson_context'] = PYSONEncoder().encode({
'active_evaluation': evaluation.id,
'evaluation': evaluation.id,
})
'evaluation': evaluation.id})
action['name'] = gettext(
'cashbook_report.msg_name_graph',
gname = evaluation.rec_name)
gname=evaluation.rec_name)
return action, {}
# end OpenChartWizard

259
investment.py Normal file
View file

@ -0,0 +1,259 @@
# -*- 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.
from trytond.pool import PoolMeta, Pool
from trytond.i18n import gettext
from decimal import Decimal
class InvestmentEvaluation(metaclass=PoolMeta):
__name__ = 'cashbook_report.evaluation'
@classmethod
def get_sel_etype(cls):
""" get list of evaluation-types
"""
result = super(InvestmentEvaluation, cls).get_sel_etype()
result.extend([
('cashbooks_gldiff', gettext(
'cashbook_report.msg_dtype_cashbook_gldiff')),
('cashbooks_glperc', gettext(
'cashbook_report.msg_dtype_cashbook_glperc')),
('cashbooks_glvalue', gettext(
'cashbook_report.msg_dtype_cashbooks_glvalue')),
('cashbooks_glyield', gettext(
'cashbook_report.msg_dtype_cashbooks_glyield')),
('category_gldiff', gettext(
'cashbook_report.msg_dtype_category_gldiff')),
('category_glvalue', gettext(
'cashbook_report.msg_dtype_category_glvalue')),
('category_glperc', gettext(
'cashbook_report.msg_dtype_category_glperc')),
('category_glyield', gettext(
'cashbook_report.msg_dtype_category_glyield')),
('types_gldiff', gettext(
'cashbook_report.msg_dtype_types_gldiff')),
('types_glvalue', gettext(
'cashbook_report.msg_dtype_types_glvalue')),
('types_glperc', gettext(
'cashbook_report.msg_dtype_types_glperc')),
('types_glyield', gettext(
'cashbook_report.msg_dtype_types_glyield')),
])
return result
# end InvestmentEvaluation
class InvestmentLine(metaclass=PoolMeta):
__name__ = 'cashbook_report.eval_line'
def get_percent_by_query(self, query):
""" get percentual difference of bookings in categories
converted to currency of evaluation
"""
Book = Pool().get('cashbook.book')
query2 = [('state', '=', 'open')]
query2.extend(query)
books = Book.search(query2)
value = Decimal('0.0')
amount = Decimal('0.0')
if len(books) > 0:
value = sum([
x.current_value_ref for x in books
if (x.current_value_ref is not None)
and (x.feature == 'asset')])
amount = sum([
x.balance_ref for x in books
if (x.balance_ref is not None) and (x.feature == 'asset')])
if amount != Decimal('0.0'):
return self.convert_to_evalcurrency(
books[0].company.currency,
Decimal('100.0') * value / amount - Decimal('100.0'))
return Decimal('0.0')
def get_difference_by_query(self, query):
""" get difference amount of bookings in categories
converted to currency of evaluation
"""
Book = Pool().get('cashbook.book')
query2 = [('state', '=', 'open')]
query2.extend(query)
books = Book.search(query2)
result = Decimal('0.0')
if len(books) > 0:
result = sum([
x.current_value_ref - x.balance_ref for x in books
if (x.current_value_ref is not None) and
(x.balance_ref is not None) and
(x.feature == 'asset')])
result = self.convert_to_evalcurrency(
books[0].company.currency, result)
return result
def get_currentvalue_by_query(self, query):
""" get current value of bookings in categories
converted to currency of evaluation
"""
Book = Pool().get('cashbook.book')
query2 = [('state', '=', 'open')]
query2.extend(query)
books = Book.search(query2)
result = Decimal('0.0')
if len(books) > 0:
for book in books:
if (book.feature == 'asset') or \
((book.feature is None) and
(book.current_value_ref is not None)):
if book.current_value_ref is not None:
result += book.current_value_ref
else:
if book.balance_ref is not None:
result += book.balance_ref
return self.convert_to_evalcurrency(
books[0].company.currency, result)
return result
def get_totalyield_by_query(self, query):
""" get total yield of cashbookings
converted to currency of evaluation
"""
Book = Pool().get('cashbook.book')
query2 = [('state', '=', 'open')]
query2.extend(query)
books = Book.search(query2)
result = Decimal('0.0')
if len(books) > 0:
for book in books:
if (book.feature == 'asset') and \
(book.yield_balance is not None):
result += self.convert_to_evalcurrency(
books[0].currency, book.yield_balance)
return result
def get_value_category_glperc(self):
""" get percent of profit/loss by category
"""
if self.category is None:
return None
return self.get_percent_by_query([
('categories.id', '=', self.category.id)])
def get_value_category_gldiff(self):
""" get difference amount by category
"""
if self.category is None:
return None
return self.get_difference_by_query([
('categories.id', '=', self.category.id)])
def get_value_category_glvalue(self):
""" get current value by category
"""
if self.category is None:
return None
return self.get_currentvalue_by_query([
('categories.id', '=', self.category.id)])
def get_value_category_glyield(self):
""" get total yield by type
"""
if self.category is None:
return None
return self.get_totalyield_by_query([
('categories.id', '=', self.category.id),
])
def get_value_types_glperc(self):
""" get percent of profit/loss by type
"""
if self.dtype is None:
return None
return self.get_percent_by_query([('btype.id', '=', self.dtype.id)])
def get_value_types_gldiff(self):
""" get difference amount by type
"""
if self.dtype is None:
return None
return self.get_difference_by_query([
('btype.id', '=', self.dtype.id)])
def get_value_types_glvalue(self):
""" get current value by type
"""
if self.dtype is None:
return None
return self.get_currentvalue_by_query([
('btype.id', '=', self.dtype.id)])
def get_value_types_glyield(self):
""" get total yield by type
"""
if self.dtype is None:
return None
return self.get_totalyield_by_query([
('btype.id', '=', self.dtype.id)])
def get_value_cashbooks_glperc(self):
""" percent of profit/loss of cashbooks
"""
if self.cashbook:
if self.cashbook.feature == 'asset':
return self.cashbook.diff_percent
else:
return Decimal('0.0')
def get_value_cashbooks_gldiff(self):
""" amount of profit/loss of cashbooks
"""
if self.cashbook:
if self.cashbook.feature == 'asset':
return self.convert_to_evalcurrency(
self.cashbook.currency,
self.cashbook.diff_amount)
else:
return Decimal('0.0')
def get_value_cashbooks_glvalue(self):
""" current value of cashbooks
"""
if self.cashbook:
if (self.cashbook.feature == 'asset') or \
((self.cashbook.feature is None) and
(self.cashbook.current_value is not None)):
return self.convert_to_evalcurrency(
self.cashbook.currency,
self.cashbook.current_value)
else:
return self.convert_to_evalcurrency(
self.cashbook.currency,
self.cashbook.balance)
def get_value_cashbooks_glyield(self):
""" total yield of investment
"""
if self.cashbook:
return self.get_totalyield_by_query([
('id', '=', self.cashbook.id)])
# end InvestmentLine

241
line.py
View file

@ -11,43 +11,57 @@ from trytond.transaction import Transaction
from trytond.i18n import gettext
from trytond.exceptions import UserError
from trytond.pool import Pool
from .templates import cashbook_types, category_types, booktype_types
class EvaluationLine(ModelSQL, ModelView):
'Evaluation Line Relation'
__name__ = 'cashbook_report.eval_line'
evaluation = fields.Many2One(string='Evaluation', required=True,
evaluation = fields.Many2One(
string='Evaluation', required=True,
select=True, ondelete='CASCADE',
model_name='cashbook_report.evaluation')
cashbook = fields.Many2One(string='Cashbook', select=True, ondelete='CASCADE',
cashbook = fields.Many2One(
string='Cashbook', select=True, ondelete='CASCADE',
model_name='cashbook.book',
states={
'required': Eval('eval_dtype', '') == 'cashbooks',
'required': Eval('eval_dtype', '').in_(cashbook_types),
}, depends=['eval_dtype'])
dtype = fields.Many2One(string='Type', select=True, ondelete='CASCADE',
dtype = fields.Many2One(
string='Type', select=True, ondelete='CASCADE',
model_name='cashbook.type',
states={
'required': Eval('eval_dtype', '') == 'types',
'required': Eval('eval_dtype', '').in_(booktype_types),
}, depends=['eval_dtype'])
currency = fields.Many2One(string='Currency', select=True, ondelete='CASCADE',
currency = fields.Many2One(
string='Currency', select=True, ondelete='CASCADE',
model_name='currency.currency',
states={
'required': Eval('eval_dtype', '') == 'currencies',
}, depends=['eval_dtype'])
category = fields.Many2One(
string='Category', select=True, ondelete='CASCADE',
model_name='cashbook.bookcategory',
states={
'required': Eval('eval_dtype', '').in_(category_types),
}, depends=['eval_dtype'])
# dtype + currency of evaluation
eval_dtype = fields.Function(fields.Char(string='Data type', readonly=True),
'on_change_with_eval_dtype')
eval_currency = fields.Function(fields.Many2One(model_name='currency.currency',
eval_dtype = fields.Function(fields.Char(
string='Data type', readonly=True), 'on_change_with_eval_dtype')
eval_currency = fields.Function(fields.Many2One(
model_name='currency.currency',
string="Currency", readonly=True), 'on_change_with_eval_currency')
currency_digits = fields.Function(fields.Integer(string='Currency Digits',
readonly=True), 'on_change_with_currency_digits')
currency_digits = fields.Function(fields.Integer(
string='Currency Digits', readonly=True),
'on_change_with_currency_digits')
name = fields.Function(fields.Char(string='Name'),
'on_change_with_name', setter='set_name_data')
name = fields.Function(fields.Char(
string='Name'), 'on_change_with_name', setter='set_name_data')
name_line = fields.Char(string='Name', states={'invisible': True})
balance = fields.Function(fields.Numeric(string='Balance',
balance = fields.Function(fields.Numeric(
string='Balance',
readonly=True, digits=(16, Eval('currency_digits', 2)),
depends=['currency_digits']),
'on_change_with_balance')
@ -56,11 +70,7 @@ class EvaluationLine(ModelSQL, ModelView):
def set_name_data(cls, lines, name, value):
""" store updated name
"""
cls.write(*[
lines,
{
'name_line': value,
}])
cls.write(*[lines, {'name_line': value}])
@classmethod
def fields_view_get(cls, view_id, view_type='form'):
@ -74,12 +84,12 @@ class EvaluationLine(ModelSQL, ModelView):
# get id of origin chart-form
form_id = ModelData.get_id('cashbook_report', 'evalline_view_graph')
# active_chart was added by tree_open-action
# active_evaluation was added by tree_open-action
active_evaluation = context.get('active_evaluation', None)
# check if we are requested for our default form...
if (view_type == 'graph') and (view_id == form_id) and \
(active_evaluation is not None):
(active_evaluation is not None):
evaluation, = Evaluation.browse([active_evaluation])
if evaluation.ui_view_chart:
# ... switch to view, created by evaluation-config
@ -90,7 +100,7 @@ class EvaluationLine(ModelSQL, ModelView):
@fields.depends('evaluation', '_parent_evaluation.dtype')
def on_change_with_eval_dtype(self, name=None):
""" get dtape from parent
""" get dtype from parent
"""
if self.evaluation:
return self.evaluation.dtype
@ -111,7 +121,9 @@ class EvaluationLine(ModelSQL, ModelView):
else:
return 2
@fields.depends('eval_dtype', 'cashbook', 'dtype', 'currency', 'name_line')
@fields.depends(
'eval_dtype', 'category', 'cashbook', 'dtype', 'currency',
'name_line')
def on_change_with_name(self, name=None):
""" get name of Type
"""
@ -122,55 +134,56 @@ class EvaluationLine(ModelSQL, ModelView):
# otherwise use rec_name of linked record
if self.eval_dtype:
dtype_sel = {'currencies': 'currency'}
dtype_sel.update({x: 'cashbook' for x in cashbook_types})
dtype_sel.update({x: 'category' for x in category_types})
dtype_sel.update({x: 'dtype' for x in booktype_types})
return getattr(
getattr(self, {
'cashbooks': 'cashbook',
'types': 'dtype',
'currencies': 'currency',
}[self.eval_dtype], None),
getattr(self, dtype_sel[self.eval_dtype], None),
'rec_name', None)
def convert_to_evalcurrency(self, from_currency, amount):
""" convert amount to current evaluation-currency
"""
Currency = Pool().get('currency.currency')
exp = Decimal(Decimal(1) / 10 ** self.currency_digits)
if amount is None:
return Decimal('0.0')
return Currency.compute(
from_currency, amount, self.eval_currency).quantize(exp)
@classmethod
def validate(cls, records):
""" check parent record
"""
super(EvaluationLine, cls).validate(records)
for record in records:
if (record.evaluation.dtype != 'cashbooks') and \
(record.cashbook is not None):
if (record.evaluation.dtype not in cashbook_types) and \
(record.cashbook is not None):
raise UserError(gettext(
'cashbook_report.msg_invalid_dtype',
typename = gettext('cashbook_report.msg_dtype_cashbook'),
))
if (record.evaluation.dtype != 'types') and \
(record.dtype is not None):
typename=gettext('cashbook_report.msg_dtype_cashbook')))
if (record.evaluation.dtype not in booktype_types) and \
(record.dtype is not None):
raise UserError(gettext(
'cashbook_report.msg_invalid_dtype',
typename = gettext('cashbook_report.msg_dtype_type'),
))
typename=gettext('cashbook_report.msg_dtype_type')))
if (record.evaluation.dtype != 'currencies') and \
(record.currency is not None):
(record.currency is not None):
raise UserError(gettext(
'cashbook_report.msg_invalid_dtype',
typename = gettext('cashbook_report.msg_dtype_currency'),
))
typename=gettext('cashbook_report.msg_dtype_currency')))
if (record.evaluation.dtype not in category_types) and \
(record.category is not None):
raise UserError(gettext(
'cashbook_report.msg_invalid_dtype',
typename=gettext('cashbook_report.msg_dtype_category')))
def get_value_cashbooks(self):
""" balance of cashbooks
"""
Currency = Pool().get('currency.currency')
if self.cashbook:
exp = Decimal(Decimal(1) / 10 ** self.currency_digits)
return Currency.compute(
self.cashbook.currency,
self.cashbook.balance,
self.eval_currency,
).quantize(exp)
def get_value_types(self):
""" get balance of bookings in cashbooks by 'type',
converted to currency of evaluation
def get_balance_by_query(self, query):
""" run 'query' on Lines, convert used
currencies to evaluation-currency
"""
pool = Pool()
Lines = pool.get('cashbook.line')
@ -180,27 +193,21 @@ class EvaluationLine(ModelSQL, ModelView):
tab_book = Cashbook.__table__()
cursor = Transaction().connection.cursor()
if (self.evaluation is None) or (self.dtype is None) or \
(self.eval_currency is None) or (self.currency_digits is None):
return None
total_amount = Decimal('0.0')
with Transaction().set_context({
'_check_access': True,
}):
lines = Lines.search([
('cashbook.btype.id', '=', self.dtype.id),
('cashbook.state', '=', 'open'),
('cashbook.owner.id', '=', Transaction().user),
], query=True)
'_check_access': True}):
lines = Lines.search(query, query=True)
query = lines.join(tab_line, condition=lines.id==tab_line.id,
).join(tab_book, condition=tab_book.id==tab_line.cashbook,
query = lines.join(
tab_line,
condition=lines.id == tab_line.id,
).join(
tab_book,
condition=tab_book.id == tab_line.cashbook,
).select(
tab_book.currency,
Sum(tab_line.credit - tab_line.debit).as_('balance'),
group_by=[tab_book.currency],
)
group_by=[tab_book.currency])
cursor.execute(*query)
balances = cursor.fetchall()
@ -208,64 +215,70 @@ class EvaluationLine(ModelSQL, ModelView):
(id_currency, bal1) = balance
if bal1 is not None:
total_amount += Currency.compute(
Currency(id_currency),
bal1,
self.eval_currency,
)
exp = Decimal(Decimal(1) / 10 ** self.currency_digits)
return total_amount.quantize(exp)
total_amount += self.convert_to_evalcurrency(
Currency(id_currency), bal1)
return total_amount
def get_value_cashbooks(self):
""" balance of cashbooks
"""
if self.cashbook:
return self.convert_to_evalcurrency(
self.cashbook.currency, self.cashbook.balance)
def get_value_categories(self):
""" get balance of bookings in categories
converted to currency of evaluation
"""
IrDate = Pool().get('ir.date')
if self.category is None:
return None
return self.get_balance_by_query([
('cashbook.categories.id', '=', self.category.id),
('cashbook.state', '=', 'open'),
('date', '<=', IrDate.today())])
def get_value_types(self):
""" get balance of bookings in cashbooks by 'type',
converted to currency of evaluation
"""
IrDate = Pool().get('ir.date')
if self.dtype is None:
return None
return self.get_balance_by_query([
('cashbook.btype.id', '=', self.dtype.id),
('cashbook.state', '=', 'open'),
('date', '<=', IrDate.today())])
def get_value_currencies(self):
""" get balance of bookings in cashbooks by 'currency',
converted to currency of evaluation
"""
pool = Pool()
Lines = pool.get('cashbook.line')
Currency = pool.get('currency.currency')
tab_line = Lines.__table__()
cursor = Transaction().connection.cursor()
IrDate = Pool().get('ir.date')
if (self.evaluation is None) or (self.currency is None) or \
(self.eval_currency is None) or (self.currency_digits is None):
if self.currency is None:
return None
total_amount = Decimal('0.0')
with Transaction().set_context({
'_check_access': True,
}):
lines = Lines.search([
return self.get_balance_by_query([
('cashbook.currency.id', '=', self.currency.id),
('cashbook.state', '=', 'open'),
('cashbook.owner.id', '=', Transaction().user),
], query=True)
('date', '<=', IrDate.today())])
query = lines.join(tab_line, condition=lines.id==tab_line.id,
).select(
Sum(tab_line.credit - tab_line.debit).as_('balance'),
)
cursor.execute(*query)
balances = cursor.fetchall()
for balance in balances:
(bal1,) = balance
if bal1 is not None:
total_amount += Currency.compute(
self.currency,
bal1,
self.eval_currency,
)
exp = Decimal(Decimal(1) / 10 ** self.currency_digits)
return total_amount.quantize(exp)
@fields.depends('eval_dtype', 'eval_currency', 'currency_digits', \
'cashbook', '_parent_cashbook.currency', '_parent_cashbook.balance',\
@fields.depends(
'eval_dtype', 'eval_currency', 'currency_digits',
'cashbook', '_parent_cashbook.currency', '_parent_cashbook.balance',
'category', '_parent_category.id',
'evaluation', '_parent_evaluation.id', 'dtype', 'currency')
def on_change_with_balance(self, name=None):
""" balance of cashbook
"""
if self.eval_dtype:
return getattr(self, 'get_value_%s' % self.eval_dtype)()
if (self.evaluation is None) or (self.eval_currency is None) or \
(self.currency_digits is None) or (self.eval_dtype is None):
return None
return getattr(self, 'get_value_%s' % self.eval_dtype)()
# end EvaluationLine

View file

@ -11,17 +11,69 @@ msgid "Type of evaluation must be '%(typename)s'."
msgstr "Typ der Auswertung mus '%(typename)s' sein."
msgctxt "model:ir.message,text:msg_dtype_cashbook"
msgid "Cashbooks"
msgstr "Kassenbücher"
msgid "Cashbooks [Amount]"
msgstr "Kassenbücher [Betrag]"
msgctxt "model:ir.message,text:msg_dtype_cashbook_gldiff"
msgid "Cashbooks [Amount of Profit/Loss]"
msgstr "Kassenbücher [Betrag Gewinn/Verlust]"
msgctxt "model:ir.message,text:msg_dtype_cashbook_glperc"
msgid "Cashbooks [Percent of Profit/Loss]"
msgstr "Kassenbücher [Prozent Gewinn/Verlust]"
msgctxt "model:ir.message,text:msg_dtype_cashbooks_glvalue"
msgid "Cashbooks [Current Value]"
msgstr "Kassenbücher [aktueller Wert]"
msgctxt "model:ir.message,text:msg_dtype_cashbooks_glyield"
msgid "Cashbooks [Total Yield]"
msgstr "Kassenbücher [Gesamtertrag]"
msgctxt "model:ir.message,text:msg_dtype_type"
msgid "Types of Cashbooks"
msgstr "Typen von Kassenbüchern"
msgid "Types of Cashbooks [Amount]"
msgstr "Typen von Kassenbüchern [Betrag]"
msgctxt "model:ir.message,text:msg_dtype_types_gldiff"
msgid "Types of Cashbooks [Amount of Profit/Loss]"
msgstr "Typen von Kassenbüchern [Betrag Gewinn/Verlust]"
msgctxt "model:ir.message,text:msg_dtype_types_glvalue"
msgid "Types of Cashbooks [Current Value]"
msgstr "Typen von Kassenbüchern [aktueller Wert]"
msgctxt "model:ir.message,text:msg_dtype_types_glperc"
msgid "Types of Cashbooks [Percent of Profit/Loss]"
msgstr "Typen von Kassenbüchern [Prozent Gewinn/Verlust]"
msgctxt "model:ir.message,text:msg_dtype_types_glyield"
msgid "Types of Cashbooks [Total Yield]"
msgstr "Typen von Kassenbüchern [Gesamtertrag]"
msgctxt "model:ir.message,text:msg_dtype_currency"
msgid "Currencies"
msgstr "Währungen"
msgctxt "model:ir.message,text:msg_dtype_category"
msgid "Categories [Amount]"
msgstr "Kategorien [Betrag]"
msgctxt "model:ir.message,text:msg_dtype_category_gldiff"
msgid "Categories [Amount of Profit/Loss]"
msgstr "Kategorien [Betrag Gewinn/Verlust]"
msgctxt "model:ir.message,text:msg_dtype_category_glvalue"
msgid "Categories [Current Value]"
msgstr "Kategorien [aktueller Wert]"
msgctxt "model:ir.message,text:msg_dtype_category_glperc"
msgid "Categories [Percent of Profit/Loss]"
msgstr "Kategorien [Prozent Gewinn/Verlust]"
msgctxt "model:ir.message,text:msg_dtype_category_glyield"
msgid "Categories [Total Yield]"
msgstr "Kategorien [Gesamtertrag]"
msgctxt "model:ir.message,text:msg_name_graph"
msgid "Graph: %(gname)s"
msgstr "Diagramm: %(gname)s"
@ -134,6 +186,10 @@ msgctxt "selection:cashbook_report.evaluation,dtype:"
msgid "Currencys"
msgstr "Währungen"
msgctxt "selection:cashbook_report.evaluation,dtype:"
msgid "Categories"
msgstr "Kategorien"
msgctxt "help:cashbook_report.evaluation,dtype:"
msgid "Type of data displayed"
msgstr "Art der dargestellten Daten"
@ -226,6 +282,10 @@ msgctxt "field:cashbook_report.evaluation,currencies:"
msgid "Currencies"
msgstr "Währungen"
msgctxt "field:cashbook_report.evaluation,categories:"
msgid "Categories"
msgstr "Kategorien"
msgctxt "field:cashbook_report.evaluation,line_values:"
msgid "Line Values"
msgstr "Zeilenwerte"

View file

@ -7,17 +7,69 @@ msgid "Type of evaluation must be '%(typename)s'."
msgstr "Type of evaluation must be '%(typename)s'."
msgctxt "model:ir.message,text:msg_dtype_cashbook"
msgid "Cashbooks"
msgstr "Cashbooks"
msgid "Cashbooks [Amount]"
msgstr "Cashbooks [Amount]"
msgctxt "model:ir.message,text:msg_dtype_cashbook_gldiff"
msgid "Cashbooks [Amount of Profit/Loss]"
msgstr "Cashbooks [Amount of Profit/Loss]"
msgctxt "model:ir.message,text:msg_dtype_cashbook_glperc"
msgid "Cashbooks [Percent of Profit/Loss]"
msgstr "Cashbooks [Percent of Profit/Loss]"
msgctxt "model:ir.message,text:msg_dtype_cashbooks_glvalue"
msgid "Cashbooks [Current Value]"
msgstr "Cashbooks [Current Value]"
msgctxt "model:ir.message,text:msg_dtype_cashbooks_glyield"
msgid "Cashbooks [Total Yield]"
msgstr "Cashbooks [Total Yield]"
msgctxt "model:ir.message,text:msg_dtype_type"
msgid "Types of Cashbooks"
msgstr "Types of Cashbooks"
msgid "Types of Cashbooks [Amount]"
msgstr "Types of Cashbooks [Amount]"
msgctxt "model:ir.message,text:msg_dtype_types_gldiff"
msgid "Types of Cashbooks [Amount of Profit/Loss]"
msgstr "Types of Cashbooks [Amount of Profit/Loss]"
msgctxt "model:ir.message,text:msg_dtype_types_glvalue"
msgid "Types of Cashbooks [Current Value]"
msgstr "Types of Cashbooks [Current Value]"
msgctxt "model:ir.message,text:msg_dtype_types_glperc"
msgid "Types of Cashbooks [Percent of Profit/Loss]"
msgstr "Types of Cashbooks [Percent of Profit/Loss]"
msgctxt "model:ir.message,text:msg_dtype_types_glyield"
msgid "Types of Cashbooks [Total Yield]"
msgstr "Types of Cashbooks [Total Yield]"
msgctxt "model:ir.message,text:msg_dtype_currency"
msgid "Currencies"
msgstr "Currencies"
msgctxt "model:ir.message,text:msg_dtype_category"
msgid "Categories [Amount]"
msgstr "Categories [Amount]"
msgctxt "model:ir.message,text:msg_dtype_category_gldiff"
msgid "Categories [Amount of Profit/Loss]"
msgstr "Categories [Amount of Profit/Loss]"
msgctxt "model:ir.message,text:msg_dtype_category_glvalue"
msgid "Categories [Current Value]"
msgstr "Categories [Current Value]"
msgctxt "model:ir.message,text:msg_dtype_category_glperc"
msgid "Categories [Percent of Profit/Loss]"
msgstr "Categories [Percent of Profit/Loss]"
msgctxt "model:ir.message,text:msg_dtype_category_glyield"
msgid "Categories [Total Yield]"
msgstr "Categories [Total Yield]"
msgctxt "model:ir.message,text:msg_name_graph"
msgid "Graph: %(gname)s"
msgstr "Graph: %(gname)s"
@ -114,6 +166,10 @@ msgctxt "selection:cashbook_report.evaluation,dtype:"
msgid "Currencys"
msgstr "Currencys"
msgctxt "selection:cashbook_report.evaluation,dtype:"
msgid "Categories"
msgstr "Categories"
msgctxt "help:cashbook_report.evaluation,dtype:"
msgid "Type of data displayed"
msgstr "Type of data displayed"
@ -206,6 +262,10 @@ msgctxt "field:cashbook_report.evaluation,currencies:"
msgid "Currencies"
msgstr "Currencies"
msgctxt "field:cashbook_report.evaluation,categories:"
msgid "Categories"
msgstr "Categories"
msgctxt "field:cashbook_report.evaluation,line_values:"
msgid "Line Values"
msgstr "Line Values"

View file

@ -9,14 +9,53 @@ full copyright notices and license terms. -->
<field name="text">Type of evaluation must be '%(typename)s'.</field>
</record>
<record model="ir.message" id="msg_dtype_cashbook">
<field name="text">Cashbooks</field>
<field name="text">Cashbooks [Amount]</field>
</record>
<record model="ir.message" id="msg_dtype_cashbook_gldiff">
<field name="text">Cashbooks [Amount of Profit/Loss]</field>
</record>
<record model="ir.message" id="msg_dtype_cashbook_glperc">
<field name="text">Cashbooks [Percent of Profit/Loss]</field>
</record>
<record model="ir.message" id="msg_dtype_cashbooks_glvalue">
<field name="text">Cashbooks [Current Value]</field>
</record>
<record model="ir.message" id="msg_dtype_cashbooks_glyield">
<field name="text">Cashbooks [Total Yield]</field>
</record>
<record model="ir.message" id="msg_dtype_type">
<field name="text">Types of Cashbooks</field>
<field name="text">Types of Cashbooks [Amount]</field>
</record>
<record model="ir.message" id="msg_dtype_types_gldiff">
<field name="text">Types of Cashbooks [Amount of Profit/Loss]</field>
</record>
<record model="ir.message" id="msg_dtype_types_glvalue">
<field name="text">ypes of Cashbooks [Current Value]</field>
</record>
<record model="ir.message" id="msg_dtype_types_glperc">
<field name="text">Types of Cashbooks [Percent of Profit/Loss]</field>
</record>
<record model="ir.message" id="msg_dtype_types_glyield">
<field name="text">Types of Cashbooks [Total Yield]</field>
</record>
<record model="ir.message" id="msg_dtype_currency">
<field name="text">Currencies</field>
</record>
<record model="ir.message" id="msg_dtype_category">
<field name="text">Categories [Amount]</field>
</record>
<record model="ir.message" id="msg_dtype_category_gldiff">
<field name="text">Categories [Amount of Profit/Loss]</field>
</record>
<record model="ir.message" id="msg_dtype_category_glvalue">
<field name="text">Categories [Current Value]</field>
</record>
<record model="ir.message" id="msg_dtype_category_glperc">
<field name="text">Categories [Percent of Profit/Loss]</field>
</record>
<record model="ir.message" id="msg_dtype_category_glyield">
<field name="text">Categories [Total Yield]</field>
</record>
<record model="ir.message" id="msg_name_graph">
<field name="text">Graph: %(gname)s</field>
</record>

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
@ -22,7 +22,7 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
# tryton.cfg einlesen
config = ConfigParser()
config.readfp(open('tryton.cfg'))
config.read_file(open('tryton.cfg'))
info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'):
if key in info:
@ -36,7 +36,7 @@ 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
@ -51,42 +51,46 @@ 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 reports to cashbook.',
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_report',
author='martin-data services',
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',
],
keywords='tryton cashbook report',
@ -95,7 +99,8 @@ setup(name='%s_%s' % (PREFIX, MODULE),
'trytond.modules.%s' % MODULE,
],
package_data={
'trytond.modules.%s' % MODULE: (info.get('xml', [])
'trytond.modules.%s' % MODULE: (
info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po', 'tests/*.py',
'view/*.xml', 'icon/*.svg',
'report/*.fods', 'versiondep.txt', 'README.rst']),

View file

@ -3,8 +3,18 @@
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
cashbook_types = [
'cashbooks', 'cashbooks_gldiff', 'cashbooks_glperc',
'cashbooks_glvalue', 'cashbooks_glyield']
category_types = [
'categories', 'category_gldiff', 'category_glvalue',
'category_glperc', 'category_glyield']
booktype_types = [
'types', 'types_gldiff', 'types_glvalue',
'types_glperc', 'types_glyield']
template_view_line = '<field name="balance" fill="%(fill)s" empty="0" string="%(string)s"/>'
template_view_line = '<field name="balance" fill="%(fill)s" ' + \
'empty="0" string="%(string)s"/>'
template_view_graph = """<?xml version="1.0"?>
<graph type="%(type)s" legend="%(legend)s" %(colscheme)s %(bgcol)s>

View file

@ -1,5 +1,7 @@
# 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
@ -10,15 +12,7 @@ from trytond.modules.cashbook_report.tests.test_report import ReportTestCase
__all__ = ['suite']
class CashbookReportTestCase(\
ReportTestCase,\
):
'Test cashbook report module'
module = 'cashbook_report'
# end CashbookReportTestCase
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(CashbookReportTestCase))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(ReportTestCase))
return suite

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,12 @@
[tryton]
version=6.0.0
version=6.0.8
depends:
res
cashbook
cashbook_bookcategory
extras_depend:
dashboard
cashbook_investment
xml:
icon.xml
message.xml

View file

@ -1 +1,3 @@
cashbook;6.0.19;6.0.999;mds
cashbook;6.0.31;6.0.999;mds
cashbook_bookcategory;6.0.4;6.0.999;mds
cashbook_investment;6.0.11;6.0.999;mds

View file

@ -20,11 +20,10 @@ full copyright notices and license terms. -->
<label name="bgcolor"/>
<field name="bgcolor"/>
<label name="posted"/>
<field name="posted"/>
<newline/>
<field name="cashbooks" colspan="6"/>
<field name="types" colspan="6"/>
<field name="currencies" colspan="6"/>
<field name="categories" colspan="6"/>
</form>

View file

@ -2,7 +2,7 @@
<!-- 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. -->
<tree keyword_open="1">
<tree keyword_open="1" sequence="sequence">
<field name="name"/>
<field name="dtype"/>
<field name="chart"/>