Browse Source

Merge pull request #2 from savoirfairelinux/7.0_account_chart_report

[ADD] account chart report
pull/5/head
Maxime Chambreuil - http://www.savoirfairelinux.com 10 years ago
parent
commit
7877edb44f
  1. 24
      account_chart_report/__init__.py
  2. 53
      account_chart_report/__openerp__.py
  3. 15
      account_chart_report/account_report.xml
  4. 78
      account_chart_report/i18n/account_chart_report.pot
  5. 78
      account_chart_report/i18n/fr.po
  6. 23
      account_chart_report/report/__init__.py
  7. 60
      account_chart_report/report/chart_of_accounts.py
  8. 64
      account_chart_report/report/chart_of_accounts.rml
  9. 23
      account_chart_report/wizard/__init__.py
  10. 47
      account_chart_report/wizard/account_report_chart_of_account.py
  11. 41
      account_chart_report/wizard/account_report_chart_of_account.xml
  12. BIN
      account_financial_report/i18n/es.mo

24
account_chart_report/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Savoir-faire Linux (<www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import report
from . import wizard

53
account_chart_report/__openerp__.py

@ -0,0 +1,53 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
{
'name': 'Print chart of accounts',
'version': '1.0',
'category': 'Reports/pdf',
'description': """Print chart of accounts.
This module add the menu Accounting \ ChartsPrint 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,
}

15
account_chart_report/account_report.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
auto="False"
id="account_chart_account"
menu="False"
model="account.account"
name="account.print.chart"
rml="account_chart_report/report/chart_of_accounts.rml"
string="Print chart account"
report_type="pdf"
/>
</data>
</openerp>

78
account_chart_report/i18n/account_chart_report.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 ""

78
account_chart_report/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 <marc.cassuto@savoirfairelinux.com>\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"

23
account_chart_report/report/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Savoir-faire Linux (<www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import chart_of_accounts

60
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 (<www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
###############################################################################
from openerp.report import report_sxw
class AccountChar(report_sxw.rml_parse):
_name = 'report.account.print.chart'
def __init__(self, cr, uid, name, context=None):
super(AccountChar, 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['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=AccountChar,
)

64
account_chart_report/report/chart_of_accounts.rml

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<document filename="Chart of accounts.pdf">
<template title="Account Balance" author="Mathieu Benoit (mathieu.benoit@savoirfairelinux.com)" allowSplitting="1">
<pageTemplate id="first">
<frame id="first" x1="35.0" y1="35.0" width="650" height="772"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Table_Tilte_Table">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockValign value="TOP"/>
<blockAlignment value="RIGHT"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P8" fontName="Helvetica"/>
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P14" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="P12a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<blockTable colWidths="650.0" style="Table_Tilte_Table">
<tr>
<td>
<para style="P15">Chart of accounts</para>
</td>
</tr>
</blockTable>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">
<font color="white"> </font>
</para>
<blockTable colWidths="70,450" style="Table2" repeatRows="1">
<tr noRowsplits="1">
<td><para style="P12a">Code</para></td>
<td><para style="P12a">Account</para></td>
</tr>
<tr>
<td><para style="P14">[[ repeatIn(get_lst_account(cr, uid, data["form"]["id_account"], actual_context), 'a') ]]<font>[[ (a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]]</font><i>[[ a['code'] or removeParentNode('tr') ]]</i></para></td>
<td><para style="P14"><font>[[ (a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]]</font><font color="white">[[ '..'*(a['level']-1) ]]</font><font>[[ a['name'] ]]</font> </para></td>
</tr>
</blockTable>
<para style="P11">
<font color="white"> </font>
</para>
</story>
</document>

23
account_chart_report/wizard/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Savoir-faire Linux (<www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import account_report_chart_of_account

47
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 (<www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, orm
class ChartOfAccountsReport(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 Accounts',
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
}

41
account_chart_report/wizard/account_report_chart_of_account.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_report_print_char_accounts_view" model="ir.ui.view">
<field name="name">Print chart of accounts</field>
<field name="model">account.print.chart.accounts.report</field>
<field name="arch" type="xml">
<form string="Report Options" version="7.0">
<group col="4" colspan="4">
<field name="chart_account_id" widget='selection'/>
</group>
<footer>
<button class="oe_highlight" name="print_report" string="Print"
type="object"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_print_chart_menu" model="ir.actions.act_window">
<field name="name">Print chart of accounts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.print.chart.accounts.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
icon="STOCK_PRINT"
name="Print chart of accounts"
parent="account.menu_finance_charts"
action="action_print_chart_menu"
id="menu_wizard_print_chart_account"
/>
</data>
</openerp>

BIN
account_financial_report/i18n/es.mo

Loading…
Cancel
Save