Added report for printing indicators

bzr revid: jvo@tinyerp.com-20081013144141-1bxg42hjgilgcifd
This commit is contained in:
Jay Vora 2008-10-13 20:11:41 +05:30
parent a9461c34d6
commit a6db3f34cc
5 changed files with 226 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<data>
<report auto="False" id="fiscal_statements" model="account.report.report" name="accounting.report" rml="account_report/report/accounting_report.rml" string="Fiscal Statements"/>
<report auto="False" id="report_print_indicators" model="account.report.report" name="report.print.indicators" rml="account_report/report/report_print_indicators.rml" string="Indicators"/>
<report auto="False" id="report_print_indicators" model="account.report.history" name="print.indicators" rml="account_report/report/print_indicator.rml" string="Indicators"/>
</data>
</openerp>

View File

@ -29,6 +29,7 @@
##############################################################################
import accounting_report
import print_indicator
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,84 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import pooler
import time
from report import report_sxw
from crm.report import report_businessopp
from report.interface import report_int
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
import reportlab.lib.colors
from reportlab.graphics import renderPM
class accounting_report1(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(accounting_report1, self).__init__(cr, uid, name, context)
self.ret_list = []
self.localcontext.update({
'time': time,
'test': self.test1,
# 'childs':self.process
})
def test1(self):
drawing = Drawing(400, 200)
data = [
(13, 5, 20, 22, 37, 45, 19, 4),
(11, 3, 10, 22, 30, 25, 29, 6),
]
bc = VerticalBarChart()
bc.x = 50
bc.y = 50
bc.height = 125
bc.width = 300
bc.data = data
bc.strokeColor = reportlab.lib.colors.black
bc.valueAxis.valueMin = 0
bc.valueAxis.valueMax = 50
bc.valueAxis.valueStep = 10
bc.categoryAxis.labels.boxAnchor = 'ne'
bc.categoryAxis.labels.dx = 8
bc.categoryAxis.labels.dy = -2
bc.categoryAxis.labels.angle = 30
bc.categoryAxis.categoryNames = ['Jan-99','Feb-99','Mar-99',
'Apr-99','May-99','Jun-99','Jul-99','Aug-99']
drawing.add(bc)
renderPM.drawToFile(drawing, 'example1.jpg','jpg')
return True
report_sxw.report_sxw('report.print.indicators', 'account.report.history',
'addons/account_report/report/print_indicator.rml',
parser=accounting_report1, header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,139 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="34.0" y1="28.0" width="527" height="786"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,0"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,0"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,0"/>
<blockBackground colorName="#ffffff" start="0,1" stop="0,1"/>
<blockBackground colorName="#ffffff" start="1,1" stop="1,1"/>
<blockBackground colorName="#ffffff" start="2,1" stop="2,1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Times-BoldItalic" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Times-Bold" fontSize="18.0" leading="22" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Times-Roman" fontSize="13.0" leading="16" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Times-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Times-Roman" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P14" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
</stylesheet>
<images/>
<story>
<para style="P1"> "Huhhhh"</para>
<blockTable colWidths="146.0,223.0,158.0" repeatRows="1" style="Table2">
<tr>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">Accounting Test</para>
</td>
<td>
<para style="P2">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P5">[[ company.name ]]</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P2">Currency: <font face="Times-Roman" size="11.0">[[ company.currency_id.name]]</font>
</para>
</td>
</tr>
</blockTable>
<para style="P3">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
<blockTable colWidths="361.0,73.0,93.0" repeatRows="1" style="Table4">
<tr>
<td>
<para style="P6">Name</para>
</td>
<td>
<para style="P6">Code</para>
</td>
<td>
<para style="P6">Amount</para>
</td>
</tr>
</blockTable>
<para style="P3">
<font color="white"> </font>
</para>
<section>
<blockTable colWidths="362.0,73.0,93.0" repeatRows="1" style="Table3">
<tr>
<td>
<para style="P11">text</para>
</td>
<td>
<para style="P11">[[ test() ]]</para>
</td>
<td>
<para style="P12">Jay</para>
</td>
</tr>
</blockTable>
<image file="//home/jvo/ws_bazaar/server/bin/example1.png"/>
<para style="P1">
<font color="white"> </font>
</para>
</section>
</story>
</document>

View File

@ -73,7 +73,7 @@ class wizard_print_indicators(wizard.interface):
},
'print': {
'actions':[],
'result' :{'type':'print','report':'report.print.indicators', 'state':'end'}
'result' :{'type':'print','report':'print.indicators', 'state':'end'}
}
}
wizard_print_indicators('print.indicators')