Browse Source

account_chart_report: PEP8 complience + update description

pull/2/head
Marc Cassuto 10 years ago
parent
commit
624856cd4a
  1. 24
      account_chart_report/__init__.py
  2. 47
      account_chart_report/__openerp__.py
  3. 15
      account_chart_report/account_report.xml
  4. 23
      account_chart_report/report/__init__.py
  5. 60
      account_chart_report/report/chart_of_accounts.py
  6. 64
      account_chart_report/report/chart_of_accounts.rml
  7. 23
      account_chart_report/wizard/__init__.py
  8. 47
      account_chart_report/wizard/account_report_chart_of_account.py
  9. 41
      account_chart_report/wizard/account_report_chart_of_account.xml

24
account_chart_report/__init__.py

@ -1,24 +0,0 @@
# -*- 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

47
account_chart_report/__openerp__.py

@ -1,47 +0,0 @@
# -*- 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.
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,
}

15
account_chart_report/account_report.xml

@ -1,15 +0,0 @@
<?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>

23
account_chart_report/report/__init__.py

@ -1,23 +0,0 @@
# -*- 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

@ -1,60 +0,0 @@
# -*- 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 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,
)

64
account_chart_report/report/chart_of_accounts.rml

@ -1,64 +0,0 @@
<?xml version="1.0"?>
<document filename="Chart of accounts.pdf">
<template title="Account Balance" author="Mathieu Benoit (mathieu.benoit@savoirfairelinux.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="35.0" y1="35.0" width="525" 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="525.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="80,340.0" 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

@ -1,23 +0,0 @@
# -*- 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

@ -1,47 +0,0 @@
# -*- 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 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
}

41
account_chart_report/wizard/account_report_chart_of_account.xml

@ -1,41 +0,0 @@
<?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>
Loading…
Cancel
Save