diff --git a/.hgignore b/.hgignore index 19a5745..c840977 100644 --- a/.hgignore +++ b/.hgignore @@ -2,3 +2,5 @@ syntax: glob build/* dist/* mds_cashbook_report.egg-info/* +locale/convert_de2en.py +__pycache__/* diff --git a/__init__.py b/__init__.py index 44a5c18..04b3213 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,9 @@ # full copyright notices and license terms. from trytond.pool import Pool +from .evaluation import Evaluation def register(): Pool.register( + Evaluation, module='cashbook_report', type_='model') diff --git a/colors.py b/colors.py new file mode 100644 index 0000000..6b6600a --- /dev/null +++ b/colors.py @@ -0,0 +1,141 @@ +# -*- 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. + +sel_color = [ + ('default', 'Default'), + ("#000000", "Black"), + ("#111111", "Gray - Dark 4"), + ('#1c1c1c', 'Gray - Dark 3'), + ('#333333', 'Gray - Dark 2'), + ('#666666', 'Gray - Dark 1'), + ('#808080', 'Gray'), + ('#999999', 'Gray - Light 1'), + ('#b2b2b2', 'Gray - Light 2'), + ('#cccccc', 'Gray - Light 3'), + ('#dddddd', 'Gray - Light 4'), + ('#eeeeee', 'Gray - Light 5'), + ('#ffffff', 'White'), + + ('#fff200', 'Yellow'), + ('#ffffc0', 'Yellow - Light 5'), + ('#fffbcc', 'Yellow - Light 4'), + ('#FFF9AE', 'Yellow - Light 3'), + ('#fff685', 'Yellow - Light 2'), + ('#fff450', 'Yellow - Light 1'), + ('#e3d200', 'Yellow - Dark 1'), + ('#ccbe00', 'Yellow - Dark 2'), + ('#a09600', 'Yellow - Dark 3'), + ('#6b6400', 'Yellow - Dark 4'), + + ('#faa61a', 'Gold'), + ('#ffe5ca', 'Gold - Light 4'), + ('#ffdaa2', 'Gold - Light 3'), + ('#fdc578', 'Gold - Light 2'), + ('#fdb94d', 'Gold - Light 1'), + ('#d99116', 'Gold - Dark 1'), + ('#c38312', 'Gold - Dark 2'), + ('#9a6704', 'Gold - Dark 3'), + ('#684703', 'Gold - Dark 4'), + + ('#f58220', 'Orange'), + ('#fedcc6', 'Orange - Light 4'), + ('#fcc79b', 'Orange - Light 3'), + ('#f9a870', 'Orange - Light 2'), + ('#f79448', 'Orange - Light 1'), + ('#d4711a', 'Orange - Dark 1'), + ('#c06616', 'Orange - Dark 2'), + ('#985006', 'Orange - Dark 3'), + ('#673604', 'Orange - Dark 4'), + + ('#ef413d', 'Brick'), + ('#fcd3c1', 'Brick - Light 4'), + ('#f8aa97', 'Brick - Light 3'), + ('#f68e76', 'Brick - Light 2'), + ('#f3715a', 'Brick - Light 1'), + ('#cf3834', 'Brick - Dark 1'), + ('#bc312e', 'Brick - Dark 2'), + ('#95231f', 'Brick - Dark 3'), + ('#6a1816', 'Brick - Dark 4'), + + ('#ed1c24', 'Red'), + ('#fcd4d1', 'Red - Light 4'), + ('#f7a19a', 'Red - Light 3'), + ('#f37b70', 'Red - Light 2'), + ('#f04e4d', 'Red - Light 1'), + ('#ce181e', 'Red - Dark 1'), + ('#ba131a', 'Red - Dark 2'), + ('#94070a', 'Red - Dark 3'), + ('#610506', 'Red - Dark 4'), + + ('#a3238e', 'Violet'), + ('#dfcce4', 'Violet - Light 4'), + ('#c7a0cb', 'Violet - Light 3'), + ('#bd7cb5', 'Violet - Light 2'), + ('#aa55a1', 'Violet - Light 1'), + ('#8f187c', 'Violet - Dark 1'), + ('#820f71', 'Violet - Dark 2'), + ('#680059', 'Violet - Dark 3'), + ('#33002b', 'Violet - Dark 4'), + + ('#5c2d91', 'Purple'), + ('#bcaed5', 'Purple - Light 4'), + ('#9d85be', 'Purple - Light 3'), + ('#826aaf', 'Purple - Light 2'), + ('#74489d', 'Purple - Light 1'), + ('#512480', 'Purple - Dark 1'), + ('#491d74', 'Purple - Dark 2'), + ('#390a5d', 'Purple - Dark 3'), + ('#1c052e', 'Purple - Dark 4'), + + ('#21409a', 'Indigo'), + ('#454fa1', 'Indigo - Light 1'), + ('#5565af', 'Indigo - Light 2'), + ('#7477b8', 'Indigo - Light 3'), + ('#8f93c7', 'Indigo - Light 4'), + ('#1c3687', 'Indigo - Dark 1'), + ('#182f7c', 'Indigo - Dark 2'), + ('#0d1f63', 'Indigo - Dark 3'), + ('#071136', 'Indigo - Dark 4'), + + ('#0066b3', 'Blue'), + ('#adc5e7', 'Blue - Light 4'), + ('#7da7d8', 'Blue - Light 3'), + ('#5e8ac7', 'Blue - Light 2'), + ('#1b75bc', 'Blue - Light 1'), + ('#00599d', 'Blue - Dark 1'), + ('#00508f', 'Blue - Dark 2'), + ('#003d73', 'Blue - Dark 3'), + ('#002342', 'Blue - Dark 4'), + + ('#00aaad', 'Teal'), + ('#bce4e5', 'Teal - Light 4'), + ('#87d1d1', 'Teal - Light 3'), + ('#59c5c7', 'Teal - Light 2'), + ('#00b6bd', 'Teal - Light 1'), + ('#009598', 'Teal - Dark 1'), + ('#00888a', 'Teal - Dark 2'), + ('#006d6f', 'Teal - Dark 3'), + ('#003c3d', 'Teal - Dark 4'), + + ('#00a65d', 'Green'), + ('#bee3d3', 'Green - Light 4'), + ('#8ccfb7', 'Green - Light 3'), + ('#65c295', 'Green - Light 2'), + ('#00b274', 'Green - Light 1'), + ('#009353', 'Green - Dark 1'), + ('#00864b', 'Green - Dark 2'), + ('#006c3b', 'Green - Dark 3'), + ('#00381f', 'Green - Dark 4'), + + ('#72bf44', 'Lime'), + ('#e0efd4', 'Lime - Light 4'), + ('#c2e0ae', 'Lime - Light 3'), + ('#add58a', 'Lime - Light 2'), + ('#89c765', 'Lime - Light 1'), + ('#62a73b', 'Lime - Dark 1'), + ('#579835', 'Lime - Dark 2'), + ('#407927', 'Lime - Dark 3'), + ('#2b511a', 'Lime - Dark 4'), +] diff --git a/evaluation.py b/evaluation.py new file mode 100644 index 0000000..ab2536f --- /dev/null +++ b/evaluation.py @@ -0,0 +1,91 @@ +# -*- 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 diff --git a/evaluation.xml b/evaluation.xml new file mode 100644 index 0000000..848f7c6 --- /dev/null +++ b/evaluation.xml @@ -0,0 +1,122 @@ + + + + + + + + cashbook_report.evaluation + tree + + evaluation_list + + + cashbook_report.evaluation + form + + evaluation_form + + + + + Evaluation + cashbook_report.evaluation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Administrators: Evaluation read/write + + + + + + + + + + + + + + + + + + + + Owners: Evaluation read/write + + + + + + + + + + + + + + + + + + User in companies + + + + + + + + + + diff --git a/icon.xml b/icon.xml new file mode 100644 index 0000000..6dc3972 --- /dev/null +++ b/icon.xml @@ -0,0 +1,14 @@ + + + + + + + mds-pie-chart + icon/piechart.svg + + + + diff --git a/icon/piechart.svg b/icon/piechart.svg new file mode 100644 index 0000000..a8d9351 --- /dev/null +++ b/icon/piechart.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + \ No newline at end of file diff --git a/locale/de.po b/locale/de.po new file mode 100644 index 0000000..8fadbb9 --- /dev/null +++ b/locale/de.po @@ -0,0 +1,131 @@ +# +msgid "" +msgstr "Content-Type: text/plain; charset=utf-8\n" + + +################# +# ir.rule.group # +################# +msgctxt "model:ir.rule.group,name:rg_eval_write_adm" +msgid "Administrators: Evaluation read/write" +msgstr "Administratoren: Auswertung schreiben" + +msgctxt "model:ir.rule.group,name:rg_eval_rw_owner" +msgid "Owners: Evaluation read/write" +msgstr "Eigentümer: Auswertung schreiben" + +msgctxt "model:ir.rule.group,name:rg_eval_companies" +msgid "User in companies" +msgstr "Benutzer im Unternehmen" + + +############## +# ir.ui.menu # +############## +msgctxt "model:ir.ui.menu,name:menu_evaluation" +msgid "Evaluation" +msgstr "Auswertung" + + +############################## +# cashbook_report.evaluation # +############################## +msgctxt "model:cashbook_report.evaluation,name:" +msgid "Evaluation" +msgstr "Auswertung" + +msgctxt "view:cashbook_report.evaluation:" +msgid "Representation" +msgstr "Darstellung" + +msgctxt "field:cashbook_report.evaluation,name:" +msgid "Name" +msgstr "Name" + +msgctxt "field:cashbook_report.evaluation,dtype:" +msgid "Data type" +msgstr "Datenart" + +msgctxt "selection:cashbook_report.evaluation,dtype:" +msgid "Cashbooks" +msgstr "Kassenbücher" + +msgctxt "selection:cashbook_report.evaluation,dtype:" +msgid "Types of Cashbooks" +msgstr "Typen von Kassenbüchern" + +msgctxt "selection:cashbook_report.evaluation,dtype:" +msgid "Currencys" +msgstr "Währungen" + +msgctxt "help:cashbook_report.evaluation,dtype:" +msgid "Type of data displayed" +msgstr "Art der dargestellten Daten" + +msgctxt "field:cashbook_report.evaluation,chart:" +msgid "Chart type" +msgstr "Diagrammtyp" + +msgctxt "help:cashbook_report.evaluation,chart:" +msgid "Type of graphical presentation." +msgstr "Art der grafischen Darstellung." + +msgctxt "selection:cashbook_report.evaluation,chart:" +msgid "Pie" +msgstr "Torte" + +msgctxt "selection:cashbook_report.evaluation,chart:" +msgid "Line" +msgstr "Linie" + +msgctxt "selection:cashbook_report.evaluation,chart:" +msgid "Vertical Bars" +msgstr "Senkrechte Balken" + +msgctxt "selection:cashbook_report.evaluation,chart:" +msgid "Horizontal Bars" +msgstr "waagerechte Balken" + +msgctxt "field:cashbook_report.evaluation,legend:" +msgid "Legend" +msgstr "Legende" + +msgctxt "field:cashbook_report.evaluation,maincolor:" +msgid "Color scheme" +msgstr "Farbschema" + +msgctxt "help:cashbook_report.evaluation,maincolor:" +msgid "The color scheme determines the hue of all components of the chart." +msgstr "Das Farbschema bestimmt den Farbton aller Komponenten des Diagramms." + +msgctxt "selection:cashbook_report.evaluation,maincolor:" +msgid "Default" +msgstr "Standard" + +msgctxt "selection:cashbook_report.evaluation,maincolor:" +msgid "Red" +msgstr "Rot" + +msgctxt "selection:cashbook_report.evaluation,maincolor:" +msgid "Green" +msgstr "Grün" + +msgctxt "selection:cashbook_report.evaluation,maincolor:" +msgid "Grey" +msgstr "Grau" + +msgctxt "selection:cashbook_report.evaluation,maincolor:" +msgid "Black" +msgstr "Schwarz" + +msgctxt "selection:cashbook_report.evaluation,maincolor:" +msgid "Dark Cyan" +msgstr "Dunkel Cyan" + +msgctxt "field:cashbook_report.evaluation,bgcolor:" +msgid "Background Color" +msgstr "Hintergrundfarbe" + +msgctxt "help:cashbook_report.evaluation,bgcolor:" +msgid "Background color of the chart area. (hex number, e.g. #ffffc0)" +msgstr "Hintergrundfarbe der Diagrammfläche. (Hexzahl, z.B. #ffffc0)" diff --git a/locale/en.po b/locale/en.po new file mode 100644 index 0000000..5e20200 --- /dev/null +++ b/locale/en.po @@ -0,0 +1,16 @@ +# +msgid "" +msgstr "Content-Type: text/plain; charset=utf-8\n" + +msgctxt "model:cashbook_report.evaluation,name:" +msgid "Evaluation" +msgstr "Evaluation" + +msgctxt "field:cashbook_report.evaluation,name:" +msgid "Name" +msgstr "Name" + +msgctxt "field:cashbook_report.evaluation,dtype:" +msgid "Data type" +msgstr "Data type" + diff --git a/menu.xml b/menu.xml new file mode 100644 index 0000000..e9fcf66 --- /dev/null +++ b/menu.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tryton.cfg b/tryton.cfg index fceac5a..43086ad 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -3,3 +3,6 @@ version=6.0.0 depends: cashbook xml: + icon.xml + evaluation.xml + menu.xml diff --git a/view/evaluation_form.xml b/view/evaluation_form.xml new file mode 100644 index 0000000..da65a28 --- /dev/null +++ b/view/evaluation_form.xml @@ -0,0 +1,20 @@ + + +
+