diff --git a/account_chart_report/__init__.py b/account_chart_report/__init__.py new file mode 100644 index 00000000..ebe217eb --- /dev/null +++ b/account_chart_report/__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/__init__.pyc b/account_chart_report/__init__.pyc new file mode 100644 index 00000000..980603da Binary files /dev/null and b/account_chart_report/__init__.pyc differ diff --git a/account_chart_report/__openerp__.py b/account_chart_report/__openerp__.py new file mode 100644 index 00000000..8ec0640d --- /dev/null +++ b/account_chart_report/__openerp__.py @@ -0,0 +1,47 @@ +# -*- 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. + +Contributors +------------ +* 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/account_report.xml b/account_chart_report/account_report.xml new file mode 100644 index 00000000..4d511857 --- /dev/null +++ b/account_chart_report/account_report.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/account_chart_report/report/__init__.py b/account_chart_report/report/__init__.py new file mode 100644 index 00000000..75edec50 --- /dev/null +++ b/account_chart_report/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/report/__init__.pyc b/account_chart_report/report/__init__.pyc new file mode 100644 index 00000000..293c7b2b Binary files /dev/null and b/account_chart_report/report/__init__.pyc differ diff --git a/account_chart_report/report/chart_of_accounts.py b/account_chart_report/report/chart_of_accounts.py new file mode 100644 index 00000000..19d8f6a6 --- /dev/null +++ b/account_chart_report/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/report/chart_of_accounts.pyc b/account_chart_report/report/chart_of_accounts.pyc new file mode 100644 index 00000000..bf375629 Binary files /dev/null and b/account_chart_report/report/chart_of_accounts.pyc differ diff --git a/account_chart_report/report/chart_of_accounts.rml b/account_chart_report/report/chart_of_accounts.rml new file mode 100644 index 00000000..da8ac8bd --- /dev/null +++ b/account_chart_report/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/static/src/img/icon.png b/account_chart_report/static/src/img/icon.png new file mode 100644 index 00000000..0dc49cdd Binary files /dev/null and b/account_chart_report/static/src/img/icon.png differ diff --git a/account_chart_report/wizard/__init__.py b/account_chart_report/wizard/__init__.py new file mode 100644 index 00000000..4b7dba05 --- /dev/null +++ b/account_chart_report/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/wizard/__init__.pyc b/account_chart_report/wizard/__init__.pyc new file mode 100644 index 00000000..ee035c9f Binary files /dev/null and b/account_chart_report/wizard/__init__.pyc differ diff --git a/account_chart_report/wizard/account_report_chart_of_account.py b/account_chart_report/wizard/account_report_chart_of_account.py new file mode 100644 index 00000000..7782ebec --- /dev/null +++ b/account_chart_report/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/wizard/account_report_chart_of_account.pyc b/account_chart_report/wizard/account_report_chart_of_account.pyc new file mode 100644 index 00000000..b2f1f0eb Binary files /dev/null and b/account_chart_report/wizard/account_report_chart_of_account.pyc differ diff --git a/account_chart_report/wizard/account_report_chart_of_account.xml b/account_chart_report/wizard/account_report_chart_of_account.xml new file mode 100644 index 00000000..af53cf83 --- /dev/null +++ b/account_chart_report/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 + + + + +
+