graph weiter gebaut
This commit is contained in:
parent
17ddfa12ca
commit
26d16a7297
11 changed files with 273 additions and 230 deletions
11
__init__.py
11
__init__.py
|
@ -4,17 +4,18 @@
|
|||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
from .evaluation import Evaluation, EvaluationCashbookRel, \
|
||||
EvaluationTypeRel, EvaluationCurrencyRel
|
||||
from .evaluation import Evaluation, EvaluationLineRel
|
||||
from .currency import Currency
|
||||
from .evaluation_context import EvaluationContext
|
||||
from .evaluation_wizard import OpenChartWizard
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
Currency,
|
||||
Evaluation,
|
||||
EvaluationCashbookRel,
|
||||
EvaluationTypeRel,
|
||||
EvaluationCurrencyRel,
|
||||
EvaluationLineRel,
|
||||
EvaluationContext,
|
||||
module='cashbook_report', type_='model')
|
||||
Pool.register(
|
||||
OpenChartWizard,
|
||||
module='cashbook_report', type_='wizard')
|
||||
|
|
243
evaluation.py
243
evaluation.py
|
@ -65,34 +65,28 @@ class Evaluation(ModelSQL, ModelView):
|
|||
model_name='currency.currency')
|
||||
|
||||
cashbooks = fields.Many2Many(string='Cashbooks',
|
||||
relation_name='cashbook_report.eval_book',
|
||||
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_type',
|
||||
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_currency',
|
||||
relation_name='cashbook_report.eval_line',
|
||||
origin='evaluation', target='currency',
|
||||
filter=[('cashbook_hasbookings', '=', True)],
|
||||
states={
|
||||
'invisible': Eval('dtype', '') != 'currencies',
|
||||
}, depends=['dtype'])
|
||||
|
||||
cashbook_values = fields.One2Many(string='Cashbook Values',
|
||||
line_values = fields.One2Many(string='Line Values',
|
||||
field='evaluation', readonly=True,
|
||||
model_name='cashbook_report.eval_book')
|
||||
currency_values = fields.One2Many(string='Currency Values',
|
||||
field='evaluation', readonly=True,
|
||||
model_name='cashbook_report.eval_currency')
|
||||
type_values = fields.One2Many(string='Type Values',
|
||||
field='evaluation', readonly=True,
|
||||
model_name='cashbook_report.eval_type')
|
||||
model_name='cashbook_report.eval_line')
|
||||
|
||||
ui_view_chart = fields.Many2One(string='UI View Point',
|
||||
model_name='ir.ui.view', ondelete='SET NULL')
|
||||
|
@ -285,43 +279,36 @@ class Evaluation(ModelSQL, ModelView):
|
|||
# end Evaluation
|
||||
|
||||
|
||||
class RelFieldsMixin(object):
|
||||
""" common fields
|
||||
"""
|
||||
class EvaluationLineRel(ModelSQL):
|
||||
'Evaluation Line Relation'
|
||||
__name__ = 'cashbook_report.eval_line'
|
||||
|
||||
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',
|
||||
model_name='cashbook.book',
|
||||
states={
|
||||
'required': Eval('eval_dtype', '') == 'cashbooks',
|
||||
}, depends=['eval_dtype'])
|
||||
dtype = fields.Many2One(string='Type', select=True, ondelete='CASCADE',
|
||||
model_name='cashbook.type',
|
||||
states={
|
||||
'required': Eval('eval_dtype', '') == 'types',
|
||||
}, depends=['eval_dtype'])
|
||||
currency = fields.Many2One(string='Currency', select=True, ondelete='CASCADE',
|
||||
model_name='currency.currency',
|
||||
states={
|
||||
'required': Eval('eval_dtype', '') == 'currencies',
|
||||
}, depends=['eval_dtype'])
|
||||
|
||||
# currency of evaluation
|
||||
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')
|
||||
|
||||
@fields.depends('evaluation', '_parent_evaluation.currency')
|
||||
def on_change_with_eval_currency(self, name=None):
|
||||
""" currency of cashbook
|
||||
"""
|
||||
if self.evaluation:
|
||||
return self.evaluation.currency.id
|
||||
|
||||
@fields.depends('evaluation', '_parent_evaluation.currency')
|
||||
def on_change_with_currency_digits(self, name=None):
|
||||
""" currency of cashbook
|
||||
"""
|
||||
if self.evaluation:
|
||||
return self.evaluation.currency.digits
|
||||
else:
|
||||
return 2
|
||||
|
||||
# end RelFieldsMixin
|
||||
|
||||
|
||||
class EvaluationCashbookRel(RelFieldsMixin, ModelSQL):
|
||||
'Evaluation Cashbook Relation'
|
||||
__name__ = 'cashbook_report.eval_book'
|
||||
|
||||
cashbook = fields.Many2One(string='Cashbook', required=True,
|
||||
select=True, ondelete='CASCADE',
|
||||
model_name='cashbook.book')
|
||||
eval_dtype = fields.Function(fields.Char(string='Data type', readonly=True),
|
||||
'on_change_with_eval_dtype')
|
||||
|
||||
name = fields.Function(fields.Char(string='Name', readonly=True),
|
||||
'on_change_with_name')
|
||||
|
@ -330,29 +317,95 @@ class EvaluationCashbookRel(RelFieldsMixin, ModelSQL):
|
|||
depends=['currency_digits']),
|
||||
'on_change_with_balance')
|
||||
|
||||
@classmethod
|
||||
def fields_view_get(cls, view_id, view_type='form'):
|
||||
""" replace form-view-id
|
||||
"""
|
||||
pool = Pool()
|
||||
ModelData = pool.get('ir.model.data')
|
||||
Evaluation = pool.get('cashbook_report.evaluation')
|
||||
context = Transaction().context
|
||||
|
||||
# get id of origin chart-form
|
||||
form_id = ModelData.get_id('cashbook_report', 'point_view_graph')
|
||||
|
||||
# active_chart 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):
|
||||
evaluation, = Evaluation.browse([active_evaluation])
|
||||
if evaluation.ui_view_point:
|
||||
# ... switch to view, created by evaluation-config
|
||||
view_id = evaluation.ui_view_point.id
|
||||
|
||||
return super(EvaluationLineRel, cls).fields_view_get(
|
||||
view_id=view_id, view_type=view_type)
|
||||
|
||||
@fields.depends('evaluation', '_parent_evaluation.dtype')
|
||||
def on_change_with_eval_dtype(self, name=None):
|
||||
""" get dtape from parent
|
||||
"""
|
||||
if self.evaluation:
|
||||
return self.evaluation.dtype
|
||||
|
||||
@fields.depends('evaluation', '_parent_evaluation.currency')
|
||||
def on_change_with_eval_currency(self, name=None):
|
||||
""" currency of evaluation
|
||||
"""
|
||||
if self.evaluation:
|
||||
return self.evaluation.currency.id
|
||||
|
||||
@fields.depends('evaluation', '_parent_evaluation.currency')
|
||||
def on_change_with_currency_digits(self, name=None):
|
||||
""" currency-digits of evaluation
|
||||
"""
|
||||
if self.evaluation:
|
||||
return self.evaluation.currency.digits
|
||||
else:
|
||||
return 2
|
||||
|
||||
@classmethod
|
||||
def validate(cls, records):
|
||||
""" check parent record
|
||||
"""
|
||||
super(EvaluationCashbookRel, cls).validate(records)
|
||||
super(EvaluationLineRel, cls).validate(records)
|
||||
for record in records:
|
||||
if record.evaluation.dtype != 'cashbooks':
|
||||
if (record.evaluation.dtype != 'cashbooks') 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):
|
||||
raise UserError(gettext(
|
||||
'cashbook_report.msg_invalid_dtype',
|
||||
typename = gettext('cashbook_report.msg_dtype_type'),
|
||||
))
|
||||
if (record.evaluation.dtype != 'currencies') and \
|
||||
(record.currency is not None):
|
||||
raise UserError(gettext(
|
||||
'cashbook_report.msg_invalid_dtype',
|
||||
typename = gettext('cashbook_report.msg_dtype_currency'),
|
||||
))
|
||||
|
||||
@fields.depends('cashbook')
|
||||
@fields.depends('eval_dtype', 'cashbook', 'dtype', 'currency')
|
||||
def on_change_with_name(self, name=None):
|
||||
""" get name of Type
|
||||
"""
|
||||
if self.cashbook:
|
||||
return self.cashbook.rec_name
|
||||
if self.eval_dtype:
|
||||
return getattr(
|
||||
getattr(self, {
|
||||
'cashbooks': 'cashbook',
|
||||
'types': 'dtype',
|
||||
'currencies': 'currency',
|
||||
}[self.eval_dtype], None),
|
||||
'rec_name', None)
|
||||
|
||||
@fields.depends('cashbook', '_parent_cashbook.currency', \
|
||||
'_parent_cashbook.balance', 'eval_currency', 'currency_digits')
|
||||
def on_change_with_balance(self, name=None):
|
||||
""" balance of cashbook
|
||||
def get_value_cashbooks(self):
|
||||
""" balance of cashbooks
|
||||
"""
|
||||
Currency = Pool().get('currency.currency')
|
||||
|
||||
|
@ -364,45 +417,7 @@ class EvaluationCashbookRel(RelFieldsMixin, ModelSQL):
|
|||
self.eval_currency,
|
||||
).quantize(exp)
|
||||
|
||||
# end EvaluationCashbookRel
|
||||
|
||||
|
||||
class EvaluationTypeRel(RelFieldsMixin, ModelSQL):
|
||||
'Evaluation Type Relation'
|
||||
__name__ = 'cashbook_report.eval_type'
|
||||
|
||||
dtype = fields.Many2One(string='Type', required=True,
|
||||
select=True, ondelete='CASCADE',
|
||||
model_name='cashbook.type')
|
||||
|
||||
name = fields.Function(fields.Char(string='Name', readonly=True),
|
||||
'on_change_with_name')
|
||||
balance = fields.Function(fields.Numeric(string='Balance',
|
||||
readonly=True, digits=(16, Eval('currency_digits', 2)),
|
||||
depends=['currency_digits']),
|
||||
'on_change_with_balance')
|
||||
|
||||
@classmethod
|
||||
def validate(cls, records):
|
||||
""" check parent record
|
||||
"""
|
||||
super(EvaluationTypeRel, cls).validate(records)
|
||||
for record in records:
|
||||
if record.evaluation.dtype != 'types':
|
||||
raise UserError(gettext(
|
||||
'cashbook_report.msg_invalid_dtype',
|
||||
typename = gettext('cashbook_report.msg_dtype_type'),
|
||||
))
|
||||
|
||||
@fields.depends('dtype')
|
||||
def on_change_with_name(self, name=None):
|
||||
""" get name of Type
|
||||
"""
|
||||
if self.dtype:
|
||||
return self.dtype.rec_name
|
||||
|
||||
@fields.depends('evaluation', 'eval_currency', 'currency_digits', 'dtype')
|
||||
def on_change_with_balance(self, name=None):
|
||||
def get_value_types(self):
|
||||
""" get balance of bookings in cashbooks by 'type',
|
||||
converted to currency of evaluation
|
||||
"""
|
||||
|
@ -446,44 +461,7 @@ class EvaluationTypeRel(RelFieldsMixin, ModelSQL):
|
|||
exp = Decimal(Decimal(1) / 10 ** self.currency_digits)
|
||||
return total_amount.quantize(exp)
|
||||
|
||||
# end EvaluationTypeRel
|
||||
|
||||
|
||||
class EvaluationCurrencyRel(RelFieldsMixin, ModelSQL):
|
||||
'Evaluation Currency Relation'
|
||||
__name__ = 'cashbook_report.eval_currency'
|
||||
|
||||
currency = fields.Many2One(string='Currency', required=True,
|
||||
select=True, ondelete='CASCADE',
|
||||
model_name='currency.currency')
|
||||
name = fields.Function(fields.Char(string='Name', readonly=True),
|
||||
'on_change_with_name')
|
||||
balance = fields.Function(fields.Numeric(string='Balance',
|
||||
readonly=True, digits=(16, Eval('currency_digits', 2)),
|
||||
depends=['currency_digits']),
|
||||
'on_change_with_balance')
|
||||
|
||||
@classmethod
|
||||
def validate(cls, records):
|
||||
""" check parent record
|
||||
"""
|
||||
super(EvaluationCurrencyRel, cls).validate(records)
|
||||
for record in records:
|
||||
if record.evaluation.dtype != 'currencies':
|
||||
raise UserError(gettext(
|
||||
'cashbook_report.msg_invalid_dtype',
|
||||
typename = gettext('cashbook_report.msg_dtype_currency'),
|
||||
))
|
||||
|
||||
@fields.depends('currency')
|
||||
def on_change_with_name(self, name=None):
|
||||
""" get name of Type
|
||||
"""
|
||||
if self.currency:
|
||||
return self.currency.rec_name
|
||||
|
||||
@fields.depends('evaluation', 'eval_currency', 'currency_digits', 'currency')
|
||||
def on_change_with_balance(self, name=None):
|
||||
def get_value_currencies(self):
|
||||
""" get balance of bookings in cashbooks by 'currency',
|
||||
converted to currency of evaluation
|
||||
"""
|
||||
|
@ -522,4 +500,13 @@ class EvaluationCurrencyRel(RelFieldsMixin, ModelSQL):
|
|||
exp = Decimal(Decimal(1) / 10 ** self.currency_digits)
|
||||
return total_amount.quantize(exp)
|
||||
|
||||
# end EvaluationCurrencyRel
|
||||
@fields.depends('eval_dtype', 'eval_currency', 'currency_digits', \
|
||||
'cashbook', '_parent_cashbook.currency', '_parent_cashbook.balance',\
|
||||
'evaluation', '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)()
|
||||
|
||||
# end EvaluationLineRel
|
||||
|
|
|
@ -13,18 +13,18 @@ full copyright notices and license terms. -->
|
|||
</record>
|
||||
|
||||
<!-- action view - cashbook-graph -->
|
||||
<record model="ir.action.act_window" id="act_evaluation_book_view">
|
||||
<record model="ir.action.act_window" id="act_evaluation_graph_view">
|
||||
<field name="name">Evaluation</field>
|
||||
<field name="res_model">cashbook_report.eval_book</field>
|
||||
<field name="res_model">cashbook_report.eval_line</field>
|
||||
<field name="context_model">cashbook_report.evaluation.context</field>
|
||||
<field name="domain"
|
||||
eval="[('evaluation', '=', Eval('evaluation', -1))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_evaluation_book_view-1">
|
||||
<record model="ir.action.act_window.view" id="act_evaluation_graph_view-1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="book_view_graph"/>
|
||||
<field name="act_window" ref="act_evaluation_book_view"/>
|
||||
<field name="act_window" ref="act_evaluation_graph_view"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
|
38
evaluation_wizard.py
Normal file
38
evaluation_wizard.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file is part of the diagram-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.wizard import Wizard, StateAction
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.i18n import gettext
|
||||
from trytond.pyson import PYSONEncoder
|
||||
|
||||
|
||||
class OpenChartWizard(Wizard):
|
||||
'Open Chart'
|
||||
__name__ = 'cashbook_report.wizchart'
|
||||
|
||||
start_state = 'open_'
|
||||
open_ = StateAction('cashbook_report.act_evaluation_graph_view')
|
||||
|
||||
def do_open_(self, action):
|
||||
""" open view from doubleclick
|
||||
"""
|
||||
Evaluation = Pool().get('cashbook_report.evaluation')
|
||||
context = Transaction().context
|
||||
|
||||
# add info to enable replace of ui-view
|
||||
evaluation, = Evaluation.browse([context['active_id']])
|
||||
if evaluation.ui_view_chart:
|
||||
action['pyson_context'] = PYSONEncoder().encode({
|
||||
'active_evaluation': evaluation.id,
|
||||
'evaluation': evaluation.id,
|
||||
})
|
||||
action['name'] = gettext(
|
||||
'cashbook_report.msg_name_graph',
|
||||
gname = evaluation.rec_name)
|
||||
return action, {}
|
||||
|
||||
# end OpenChartWizard
|
21
evaluation_wizard.xml
Normal file
21
evaluation_wizard.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of the diagram-module from m-ds for Tryton.
|
||||
The COPYRIGHT file at the top level of this repository contains the
|
||||
full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
|
||||
<record model="ir.action.wizard" id="wizard_open_chart">
|
||||
<field name="name">Open Chart</field>
|
||||
<field name="wiz_name">cashbook_report.wizchart</field>
|
||||
<field name="model">cashbook_report.evaluation</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.keyword" id="wizard_open_chart_keyword1">
|
||||
<field name="keyword">tree_open</field>
|
||||
<field name="model">cashbook_report.evaluation,-1</field>
|
||||
<field name="action" ref="wizard_open_chart"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
23
line_value.xml
Normal file
23
line_value.xml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of the diagram-module from m-ds for Tryton.
|
||||
The COPYRIGHT file at the top level of this repository contains the
|
||||
full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
|
||||
<!-- views -->
|
||||
<record model="ir.ui.view" id="evalline_view_graph">
|
||||
<field name="model">cashbook_report.eval_line</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">evalline_graph</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="evalline_view_list">
|
||||
<field name="model">cashbook_report.eval_line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">evalline_list</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
96
locale/de.po
96
locale/de.po
|
@ -22,6 +22,10 @@ msgctxt "model:ir.message,text:msg_dtype_currency"
|
|||
msgid "Currencies"
|
||||
msgstr "Währungen"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_name_graph"
|
||||
msgid "Graph: %(gname)s"
|
||||
msgstr "Diagramm: %(gname)s"
|
||||
|
||||
|
||||
#################
|
||||
# ir.rule.group #
|
||||
|
@ -48,84 +52,48 @@ msgstr "Auswertung"
|
|||
|
||||
|
||||
#############################
|
||||
# cashbook_report.eval_book #
|
||||
# cashbook_report.eval_line #
|
||||
#############################
|
||||
msgctxt "model:cashbook_report.eval_book,name:"
|
||||
msgid "Evaluation Cashbook Relation"
|
||||
msgstr "Auswertung Kassenbuch Verknüpfung"
|
||||
msgctxt "model:cashbook_report.eval_line,name:"
|
||||
msgid "Evaluation Line Relation"
|
||||
msgstr "Auswertung Zeile Verknüpfung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_book,evaluation:"
|
||||
msgctxt "field:cashbook_report.eval_line,evaluation:"
|
||||
msgid "Evaluation"
|
||||
msgstr "Auswertung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_book,cashbook:"
|
||||
msgctxt "field:cashbook_report.eval_line,cashbook:"
|
||||
msgid "Cashbook"
|
||||
msgstr "Kassenbuch"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_book,eval_currency:"
|
||||
msgctxt "field:cashbook_report.eval_line,dtype:"
|
||||
msgid "Data type"
|
||||
msgstr "Datenart"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_line,currency:"
|
||||
msgid "Currency"
|
||||
msgstr "Währung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_book,currency_digits:"
|
||||
msgctxt "field:cashbook_report.eval_line,eval_currency:"
|
||||
msgid "Currency"
|
||||
msgstr "Währung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_line,currency_digits:"
|
||||
msgid "Currency Digits"
|
||||
msgstr "Nachkommastellen Währung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_line,eval_dtype:"
|
||||
msgid "Data type"
|
||||
msgstr "Datenart"
|
||||
|
||||
#############################
|
||||
# cashbook_report.eval_type #
|
||||
#############################
|
||||
msgctxt "model:cashbook_report.eval_type,name:"
|
||||
msgid "Evaluation Type Relation"
|
||||
msgstr "Auswertung Typ Verknüpfung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_type,evaluation:"
|
||||
msgid "Evaluation"
|
||||
msgstr "Auswertung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_type,dtype:"
|
||||
msgid "Type"
|
||||
msgstr "Typ"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_type,name:"
|
||||
msgctxt "field:cashbook_report.eval_line,name:"
|
||||
msgid "Name"
|
||||
msgstr "Name"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_type,balance:"
|
||||
msgctxt "field:cashbook_report.eval_line,balance:"
|
||||
msgid "Balance"
|
||||
msgstr "Saldo"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_type,eval_currency:"
|
||||
msgid "Currency"
|
||||
msgstr "Währung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_type,currency_digits:"
|
||||
msgid "Currency Digits"
|
||||
msgstr "Nachkommastellen Währung"
|
||||
|
||||
|
||||
#################################
|
||||
# cashbook_report.eval_currency #
|
||||
#################################
|
||||
msgctxt "model:cashbook_report.eval_currency,name:"
|
||||
msgid "Evaluation Currency Relation"
|
||||
msgstr "Auswertung Währung Verknüpfung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_currency,evaluation:"
|
||||
msgid "Evaluation"
|
||||
msgstr "Auswertung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_currency,currency:"
|
||||
msgid "Currency"
|
||||
msgstr "Währung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_currency,eval_currency:"
|
||||
msgid "Currency"
|
||||
msgstr "Währung"
|
||||
|
||||
msgctxt "field:cashbook_report.eval_currency,currency_digits:"
|
||||
msgid "Currency Digits"
|
||||
msgstr "Nachkommastellen Währung"
|
||||
|
||||
|
||||
##############################
|
||||
# cashbook_report.evaluation #
|
||||
|
@ -250,25 +218,17 @@ msgctxt "field:cashbook_report.evaluation,cashbooks:"
|
|||
msgid "Cashbooks"
|
||||
msgstr "Kassenbücher"
|
||||
|
||||
msgctxt "field:cashbook_report.evaluation,cashbook_values:"
|
||||
msgid "Cashbook Values"
|
||||
msgstr "Kassenbuchwerte"
|
||||
|
||||
msgctxt "field:cashbook_report.evaluation,types:"
|
||||
msgid "Types"
|
||||
msgstr "Typen"
|
||||
|
||||
msgctxt "field:cashbook_report.evaluation,type_values:"
|
||||
msgid "Type Values"
|
||||
msgstr "Typwerte"
|
||||
|
||||
msgctxt "field:cashbook_report.evaluation,currencies:"
|
||||
msgid "Currencies"
|
||||
msgstr "Währungen"
|
||||
|
||||
msgctxt "field:cashbook_report.evaluation,currency_values:"
|
||||
msgid "Currency Values"
|
||||
msgstr "Währungswerte"
|
||||
msgctxt "field:cashbook_report.evaluation,line_values:"
|
||||
msgid "Line Values"
|
||||
msgstr "Zeilenwerte"
|
||||
|
||||
msgctxt "field:cashbook_report.evaluation,currency:"
|
||||
msgid "Currency"
|
||||
|
|
|
@ -17,6 +17,9 @@ full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_dtype_currency">
|
||||
<field name="text">Currencies</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_name_graph">
|
||||
<field name="text">Graph: %(gname)s</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -172,7 +172,7 @@ class ReportTestCase(CashbookTestCase):
|
|||
|
||||
@with_transaction()
|
||||
def test_report_dtype_update(self):
|
||||
""" check unlink of cashbooks/types/currenciews
|
||||
""" check unlink of cashbooks/types/currencies
|
||||
"""
|
||||
pool = Pool()
|
||||
Evaluation = pool.get('cashbook_report.evaluation')
|
||||
|
@ -257,7 +257,7 @@ class ReportTestCase(CashbookTestCase):
|
|||
|
||||
# must fail
|
||||
self.assertRaisesRegex(UserError,
|
||||
"Type of evaluation must be 'Cashbooks'.",
|
||||
'A value is required for field "Type" in "Evaluation Line Relation".',
|
||||
Evaluation.create,
|
||||
[{
|
||||
'name': 'Evaluation 1',
|
||||
|
@ -273,7 +273,7 @@ class ReportTestCase(CashbookTestCase):
|
|||
|
||||
# must fail
|
||||
self.assertRaisesRegex(UserError,
|
||||
"Type of evaluation must be 'Types of Cashbooks'.",
|
||||
'A value is required for field "Cashbook" in "Evaluation Line Relation".',
|
||||
Evaluation.create,
|
||||
[{
|
||||
'name': 'Evaluation 3',
|
||||
|
@ -330,18 +330,18 @@ class ReportTestCase(CashbookTestCase):
|
|||
self.assertEqual(evaluation.cashbooks[1].currency.code, 'usd')
|
||||
self.assertEqual(evaluation.cashbooks[2].currency.code, 'EUR')
|
||||
|
||||
self.assertEqual(len(evaluation.cashbook_values), 3)
|
||||
self.assertEqual(evaluation.cashbook_values[0].name, 'Book 1 | 25.00 usd | Open')
|
||||
self.assertEqual(evaluation.cashbook_values[1].name, 'Book 2 | 12.50 usd | Open')
|
||||
self.assertEqual(evaluation.cashbook_values[2].name, 'Book 3 | 23.00 € | Open')
|
||||
self.assertEqual(len(evaluation.line_values), 3)
|
||||
self.assertEqual(evaluation.line_values[0].name, 'Book 1 | 25.00 usd | Open')
|
||||
self.assertEqual(evaluation.line_values[1].name, 'Book 2 | 12.50 usd | Open')
|
||||
self.assertEqual(evaluation.line_values[2].name, 'Book 3 | 23.00 € | Open')
|
||||
|
||||
self.assertEqual(evaluation.cashbook_values[0].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.cashbook_values[1].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.cashbook_values[2].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.line_values[0].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.line_values[1].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.line_values[2].eval_currency.code, 'EUR')
|
||||
|
||||
self.assertEqual(evaluation.cashbook_values[0].balance, Decimal('23.81'))
|
||||
self.assertEqual(evaluation.cashbook_values[1].balance, Decimal('11.90'))
|
||||
self.assertEqual(evaluation.cashbook_values[2].balance, Decimal('23.00'))
|
||||
self.assertEqual(evaluation.line_values[0].balance, Decimal('23.81'))
|
||||
self.assertEqual(evaluation.line_values[1].balance, Decimal('11.90'))
|
||||
self.assertEqual(evaluation.line_values[2].balance, Decimal('23.00'))
|
||||
|
||||
@with_transaction()
|
||||
def test_report_chart_pie_type_red(self):
|
||||
|
@ -378,15 +378,15 @@ class ReportTestCase(CashbookTestCase):
|
|||
self.assertEqual(evaluation.types[0].rec_name, 'BK - Bank')
|
||||
self.assertEqual(evaluation.types[1].rec_name, 'CAS - Cash')
|
||||
# 23.00 EUR
|
||||
self.assertEqual(len(evaluation.type_values), 2)
|
||||
self.assertEqual(evaluation.type_values[0].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.type_values[0].name, 'BK - Bank')
|
||||
self.assertEqual(evaluation.type_values[0].balance, Decimal('23.0'))
|
||||
self.assertEqual(len(evaluation.line_values), 2)
|
||||
self.assertEqual(evaluation.line_values[0].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.line_values[0].name, 'BK - Bank')
|
||||
self.assertEqual(evaluation.line_values[0].balance, Decimal('23.0'))
|
||||
|
||||
# 37.50 USD --> EUR
|
||||
self.assertEqual(evaluation.type_values[1].name, 'CAS - Cash')
|
||||
self.assertEqual(evaluation.type_values[1].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.type_values[1].balance, Decimal('35.71'))
|
||||
self.assertEqual(evaluation.line_values[1].name, 'CAS - Cash')
|
||||
self.assertEqual(evaluation.line_values[1].eval_currency.code, 'EUR')
|
||||
self.assertEqual(evaluation.line_values[1].balance, Decimal('35.71'))
|
||||
|
||||
@with_transaction()
|
||||
def test_report_chart_pie_currency_red(self):
|
||||
|
@ -420,10 +420,10 @@ class ReportTestCase(CashbookTestCase):
|
|||
self.assertEqual(evaluation.currencies[0].code, 'EUR')
|
||||
self.assertEqual(evaluation.currencies[1].code, 'usd')
|
||||
|
||||
self.assertEqual(len(evaluation.currency_values), 2)
|
||||
self.assertEqual(evaluation.currency_values[0].name, 'Euro')
|
||||
self.assertEqual(evaluation.currency_values[0].balance, Decimal('23.0'))
|
||||
self.assertEqual(evaluation.currency_values[1].name, 'usd')
|
||||
self.assertEqual(evaluation.currency_values[1].balance, Decimal('35.71'))
|
||||
self.assertEqual(len(evaluation.line_values), 2)
|
||||
self.assertEqual(evaluation.line_values[0].name, 'Euro')
|
||||
self.assertEqual(evaluation.line_values[0].balance, Decimal('23.0'))
|
||||
self.assertEqual(evaluation.line_values[1].name, 'usd')
|
||||
self.assertEqual(evaluation.line_values[1].balance, Decimal('35.71'))
|
||||
|
||||
# end ReportTestCase
|
||||
|
|
|
@ -7,5 +7,7 @@ xml:
|
|||
message.xml
|
||||
graph.xml
|
||||
evaluation.xml
|
||||
line_value.xml
|
||||
evaluation_context.xml
|
||||
evaluation_wizard.xml
|
||||
menu.xml
|
||||
|
|
8
view/evaluation_context_form.xml
Normal file
8
view/evaluation_context_form.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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. -->
|
||||
<form col="2">
|
||||
<label name="evaluation"/>
|
||||
<field name="evaluation"/>
|
||||
</form>
|
Loading…
Reference in a new issue