92 lines
2.4 KiB
Python
92 lines
2.4 KiB
Python
![]() |
# -*- 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.model import ModelView, ModelSQL, fields, Check
|
||
|
from trytond.pyson import Eval, Or, Bool, Id, Len
|
||
|
from trytond.transaction import Transaction
|
||
|
from .colors import sel_color as sel_bgcolor
|
||
|
|
||
|
|
||
|
sel_etype = [
|
||
|
('book', 'Cashbooks'),
|
||
|
('type', 'Types of Cashbooks'),
|
||
|
('currency', 'Currencys'),
|
||
|
]
|
||
|
|
||
|
sel_chart = [
|
||
|
('vbar', 'Vertical Bars'),
|
||
|
('hbar', 'Horizontal Bars'),
|
||
|
('pie', 'Pie'),
|
||
|
('line', 'Line'),
|
||
|
]
|
||
|
|
||
|
|
||
|
sel_maincolor = [
|
||
|
('default', 'Default'),
|
||
|
('red', 'Red'),
|
||
|
('green', 'Green'),
|
||
|
('grey', 'Grey'),
|
||
|
('black', 'Black'),
|
||
|
('darkcyan', 'Dark Cyan'),
|
||
|
]
|
||
|
|
||
|
|
||
|
class Evaluation(ModelSQL, ModelView):
|
||
|
'Evaluation'
|
||
|
__name__ = 'cashbook_report.evaluation'
|
||
|
|
||
|
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')
|
||
|
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,
|
||
|
help='Background color of the chart area.', sort=False,
|
||
|
selection=sel_bgcolor)
|
||
|
|
||
|
@staticmethod
|
||
|
def default_company():
|
||
|
return Transaction().context.get('company') or None
|
||
|
|
||
|
@classmethod
|
||
|
def default_bgcolor(cls):
|
||
|
""" default: Yellow 5
|
||
|
"""
|
||
|
return '#ffffc0'
|
||
|
|
||
|
@classmethod
|
||
|
def default_maincolor(cls):
|
||
|
""" default: 'default'
|
||
|
"""
|
||
|
return 'default'
|
||
|
|
||
|
@classmethod
|
||
|
def default_legend(cls):
|
||
|
""" default True
|
||
|
"""
|
||
|
return True
|
||
|
|
||
|
@classmethod
|
||
|
def default_etype(cls):
|
||
|
""" default 'book'
|
||
|
"""
|
||
|
return 'book'
|
||
|
|
||
|
@classmethod
|
||
|
def default_chart(cls):
|
||
|
""" default 'pir'
|
||
|
"""
|
||
|
return 'pie'
|
||
|
|
||
|
# end Evaluation
|