From 069d00e4db3e67e9595b0244f33cefb1ee519a8b Mon Sep 17 00:00:00 2001 From: Marc Cassuto Date: Wed, 30 Jul 2014 14:58:52 -0400 Subject: [PATCH] account_chart_report_rml: rename module + add translation pot file + add fr translation --- account_chart_report_rml/__init__.py | 24 ++++++ account_chart_report_rml/__openerp__.py | 53 +++++++++++++ account_chart_report_rml/account_report.xml | 15 ++++ .../i18n/account_chart_report_rml.pot | 78 +++++++++++++++++++ account_chart_report_rml/i18n/fr.po | 78 +++++++++++++++++++ account_chart_report_rml/report/__init__.py | 23 ++++++ .../report/chart_of_accounts.py | 60 ++++++++++++++ .../report/chart_of_accounts.rml | 64 +++++++++++++++ account_chart_report_rml/wizard/__init__.py | 23 ++++++ .../wizard/account_report_chart_of_account.py | 47 +++++++++++ .../account_report_chart_of_account.xml | 41 ++++++++++ 11 files changed, 506 insertions(+) create mode 100644 account_chart_report_rml/__init__.py create mode 100644 account_chart_report_rml/__openerp__.py create mode 100644 account_chart_report_rml/account_report.xml create mode 100644 account_chart_report_rml/i18n/account_chart_report_rml.pot create mode 100644 account_chart_report_rml/i18n/fr.po create mode 100644 account_chart_report_rml/report/__init__.py create mode 100644 account_chart_report_rml/report/chart_of_accounts.py create mode 100644 account_chart_report_rml/report/chart_of_accounts.rml create mode 100644 account_chart_report_rml/wizard/__init__.py create mode 100644 account_chart_report_rml/wizard/account_report_chart_of_account.py create mode 100644 account_chart_report_rml/wizard/account_report_chart_of_account.xml diff --git a/account_chart_report_rml/__init__.py b/account_chart_report_rml/__init__.py new file mode 100644 index 00000000..c2451dfb --- /dev/null +++ b/account_chart_report_rml/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +############################################################################### +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014 Savoir-faire Linux (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + +from . import report +from . import wizard diff --git a/account_chart_report_rml/__openerp__.py b/account_chart_report_rml/__openerp__.py new file mode 100644 index 00000000..9569f452 --- /dev/null +++ b/account_chart_report_rml/__openerp__.py @@ -0,0 +1,53 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Savoir-faire Linux +# (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + + +{ + 'name': 'Print chart of accounts', + 'version': '1.0', + 'category': 'Reports/pdf', + 'description': """Print chart of accounts. + +This module add the menu Accounting \ Charts \ Print chart of Accounts +and allow to print the selected chart of accounts. + +This module is based on the old RML engine report. + +Contributors +------------ +* Marc Cassuto (marc.cassuto@savoirfairelinux.com) +* Mathieu Benoit (mathieu.benoit@savoirfairelinux.com) + + """, + 'author': 'Savoir-faire Linux', + 'website': 'http://www.savoirfairelinux.com', + 'depends': [ + 'base', + 'account', + ], + 'data': [ + 'account_report.xml', + 'wizard/account_report_chart_of_account.xml', + ], + 'installable': True, + 'auto_install': False, +} diff --git a/account_chart_report_rml/account_report.xml b/account_chart_report_rml/account_report.xml new file mode 100644 index 00000000..b0f4d55d --- /dev/null +++ b/account_chart_report_rml/account_report.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/account_chart_report_rml/i18n/account_chart_report_rml.pot b/account_chart_report_rml/i18n/account_chart_report_rml.pot new file mode 100644 index 00000000..05687a7b --- /dev/null +++ b/account_chart_report_rml/i18n/account_chart_report_rml.pot @@ -0,0 +1,78 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_chart_report +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-07-30 18:52+0000\n" +"PO-Revision-Date: 2014-07-30 18:52+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_chart_report +#: report:account.print.chart:0 +msgid "Account" +msgstr "" + +#. module: account_chart_report +#: report:account.print.chart:0 +msgid "Code" +msgstr "" + +#. module: account_chart_report +#: model:ir.actions.act_window,name:account_chart_report.action_print_chart_menu +#: model:ir.ui.menu,name:account_chart_report.menu_wizard_print_chart_account +msgid "Print chart of accounts" +msgstr "" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "Print" +msgstr "" + +#. module: account_chart_report +#: model:ir.model,name:account_chart_report.model_account_print_chart_accounts_report +msgid "Chart of accounts Report" +msgstr "" + +#. module: account_chart_report +#: model:ir.actions.report.xml,name:account_chart_report.account_chart_account +msgid "Print chart account" +msgstr "" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "Cancel" +msgstr "" + +#. module: account_chart_report +#: field:account.print.chart.accounts.report,chart_account_id:0 +msgid "Chart of Account" +msgstr "" + +#. module: account_chart_report +#: report:account.print.chart:0 +msgid "Chart of accounts" +msgstr "" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "or" +msgstr "" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "Report Options" +msgstr "" + +#. module: account_chart_report +#: help:account.print.chart.accounts.report,chart_account_id:0 +msgid "Select Charts of Accounts" +msgstr "" + diff --git a/account_chart_report_rml/i18n/fr.po b/account_chart_report_rml/i18n/fr.po new file mode 100644 index 00000000..18d88c26 --- /dev/null +++ b/account_chart_report_rml/i18n/fr.po @@ -0,0 +1,78 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_chart_report +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-07-30 18:52+0000\n" +"PO-Revision-Date: 2014-07-30 14:56-0500\n" +"Last-Translator: Marc Cassuto \n" +"Language-Team: Savoir-faire Linux\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"Language: fr\n" + +#. module: account_chart_report +#: report:account.print.chart:0 +msgid "Account" +msgstr "Compte" + +#. module: account_chart_report +#: report:account.print.chart:0 +msgid "Code" +msgstr "Code" + +#. module: account_chart_report +#: model:ir.actions.act_window,name:account_chart_report.action_print_chart_menu +#: model:ir.ui.menu,name:account_chart_report.menu_wizard_print_chart_account +msgid "Print chart of accounts" +msgstr "Imprimer la charte de comptes" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "Print" +msgstr "Imprimer" + +#. module: account_chart_report +#: model:ir.model,name:account_chart_report.model_account_print_chart_accounts_report +msgid "Chart of accounts Report" +msgstr "Charte de comptes" + +#. module: account_chart_report +#: model:ir.actions.report.xml,name:account_chart_report.account_chart_account +msgid "Print chart account" +msgstr "Imprimer la charte de comptes" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "Cancel" +msgstr "Annuler" + +#. module: account_chart_report +#: field:account.print.chart.accounts.report,chart_account_id:0 +msgid "Chart of Account" +msgstr "Charte de comptes" + +#. module: account_chart_report +#: report:account.print.chart:0 +msgid "Chart of accounts" +msgstr "Charte de comptes" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "or" +msgstr "ou" + +#. module: account_chart_report +#: view:account.print.chart.accounts.report:0 +msgid "Report Options" +msgstr "Options du rapport" + +#. module: account_chart_report +#: help:account.print.chart.accounts.report,chart_account_id:0 +msgid "Select Charts of Accounts" +msgstr "Charte de compte à imprimer" diff --git a/account_chart_report_rml/report/__init__.py b/account_chart_report_rml/report/__init__.py new file mode 100644 index 00000000..89ef0951 --- /dev/null +++ b/account_chart_report_rml/report/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +############################################################################### +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014 Savoir-faire Linux (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + +from . import chart_of_accounts diff --git a/account_chart_report_rml/report/chart_of_accounts.py b/account_chart_report_rml/report/chart_of_accounts.py new file mode 100644 index 00000000..6905edb5 --- /dev/null +++ b/account_chart_report_rml/report/chart_of_accounts.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +############################################################################### +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014 Savoir-faire Linux (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + +from openerp.report import report_sxw + + +class account_char(report_sxw.rml_parse): + _name = 'report.account.print.chart' + + def __init__(self, cr, uid, name, context=None): + super(account_char, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ + "get_lst_account": self._get_lst_account, + "cr": cr, + "uid": uid, + "actual_context": context, + }) + + def _get_lst_account(self, cr, uid, account_id, context): + account_obj = self.pool.get("account.account") + actual_account = account_obj.browse(cr, uid, account_id, + context=context) + lst_account = [] + self._fill_list_account_with_child(lst_account, actual_account) + return lst_account + + def _fill_list_account_with_child(self, lst_account, account): + # no more child + lst_account.append(account) + if not account.child_id: + return + for child in account.child_id: + self._fill_list_account_with_child(lst_account, child) + + +report_sxw.report_sxw( + 'report.account.print.chart', + 'account.account', + 'account_chart_report/report/chart_of_accounts.rml', + parser=account_char, +) diff --git a/account_chart_report_rml/report/chart_of_accounts.rml b/account_chart_report_rml/report/chart_of_accounts.rml new file mode 100644 index 00000000..da8ac8bd --- /dev/null +++ b/account_chart_report_rml/report/chart_of_accounts.rml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Chart of accounts + + + + + + + + + + + + + + + + + + Code + Account + + + [[ repeatIn(get_lst_account(cr, uid, data["form"]["id_account"], actual_context), 'a') ]][[ (a['type']<>'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ a['code'] or removeParentNode('tr') ]] + [[ (a['type']<>'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ '..'*(a['level']-1) ]][[ a['name'] ]] + + + + + + + diff --git a/account_chart_report_rml/wizard/__init__.py b/account_chart_report_rml/wizard/__init__.py new file mode 100644 index 00000000..4b7dba05 --- /dev/null +++ b/account_chart_report_rml/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014 Savoir-faire Linux (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import account_report_chart_of_account diff --git a/account_chart_report_rml/wizard/account_report_chart_of_account.py b/account_chart_report_rml/wizard/account_report_chart_of_account.py new file mode 100644 index 00000000..7782ebec --- /dev/null +++ b/account_chart_report_rml/wizard/account_report_chart_of_account.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2014 Savoir-faire Linux (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import fields, orm + + +class chart_of_account_report(orm.TransientModel): + _name = 'account.print.chart.accounts.report' + _description = 'Chart of accounts Report' + + domain_char_account = [('parent_id', '=', False)] + _columns = { + 'chart_account_id': fields.many2one('account.account', + 'Chart of Account', + help='Select Charts of Accounts', + required=True, + domain=domain_char_account), + } + + def print_report(self, cr, uid, ids, data, context=None): + res = self.read(cr, uid, ids, context=context)[0] + account_id = res["chart_account_id"][0] + data["form"] = {"id_account": account_id} + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'account.print.chart', + 'datas': data + } diff --git a/account_chart_report_rml/wizard/account_report_chart_of_account.xml b/account_chart_report_rml/wizard/account_report_chart_of_account.xml new file mode 100644 index 00000000..af53cf83 --- /dev/null +++ b/account_chart_report_rml/wizard/account_report_chart_of_account.xml @@ -0,0 +1,41 @@ + + + + + + Print chart of accounts + account.print.chart.accounts.report + +
+ + + +
+
+
+
+
+ + + Print chart of accounts + ir.actions.act_window + account.print.chart.accounts.report + form + form + new + + + + +
+