moving module from extra_addons to trunk addons

and applying changes according to the the qdp requires

bzr revid: mga@mga-laptop-20081023055355-tf0yfsqsrddkom5g
This commit is contained in:
Mantavya Gajjar 2008-10-23 11:23:55 +05:30
parent 05a5fa3648
commit 58d75ac28b
21 changed files with 3042 additions and 0 deletions

View File

@ -0,0 +1,3 @@
import voucher
import voucher_account
import report

View File

@ -0,0 +1,33 @@
{
"name" : "India Accounting",
"version" : "1.0",
"author" : "Tiny",
"description": """
India Accounting module includes all the basic requirenment of
Basic Accounting, plus new things which available are
* Indian Account Chart
* New Invoice - (Local, Retail)
* Invoice Report
* Tax structure
* Journals
* VAT Declaration report
* Accounting Periods
""",
"category" : "Generic Modules/Accounting",
"website" : "http://tinyerp.com",
"depends" : ["base", "account"],
"init_xml" : [
],
"demo_xml" : [
],
"update_xml" : [
"account_voucher_sequence.xml",
"account_view.xml",
"account_report.xml",
"voucher_view.xml",
],
"active": False,
"installable": True
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0"?>
<terp>
<data>
<report id="account_invoices_tax"
string="Invoices"
model="account.invoice"
name="tax.retail.account.invoice"
rml="account_voucher/report/invoice.rml"
auto="False"
/>
<report id="account_vat_declaration_india"
string="Taxes report"
model="account.invoice"
name="indianvat.declaration"
rml="account_voucher/report/tax_report.rml"
auto="False"
menu="True"/>
<wizard
string="Wizard Indiataxes report"
model="account.invoice"
name="account.indianvat.declaration"
menu="False"
id="wizard_indianvat_declaration"/>
<menuitem
name="Financial Management/Reporting/India Taxes Report"
action="wizard_indianvat_declaration"
type="wizard"
id="wizard_indianvat_declaration_menu"/>
<report id="report_account_voucher"
string="Voucher Report (Cr/Dr)"
model="account.voucher"
name="voucher.cash_receipt"
rml="account_voucher/report/report_voucher.rml"
auto="False"
header = "False"
menu="True"/>
<report id="report_account_voucher_amt"
string="Voucher Report"
model="account.voucher"
name="voucher.cash_amount"
rml="account_voucher/report/report_voucher_amount.rml"
auto="False"
header = "False"
menu="True"/>
</data>
</terp>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="account_form1">
<field name="name">account.form</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="user_type" position="after">
<field name="diff" select="2" />
<field name="balance" string="Closing Balance" select="2"/>
<field name="type1" select="2" />
<field name="open_bal" select="2"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_form2">
<field name="name">account.form</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="user_type" position="replace">
<field name="user_type" select="1" on_change="onchange_type(user_type,type1)"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_form3">
<field name="name">account.form</field>
<field name="inherit_id" ref="account.view_account_tree"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="open_bal" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_form4">
<field name="name">account.form</field>
<field name="inherit_id" ref="account.view_account_tree"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="balance" position="replace">
<field name="balance" />
<field name="type1"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<record model="res.request.link" id="req_link_voucher">
<field name="name">Voucher</field>
<field name="object">account.voucher</field>
</record>
<!--
Sequences types for vouchers
-->
<record model="ir.sequence.type" id="seq_type_cash_rec_voucher">
<field name="name">Account Cash Received Voucher</field>
<field name="code">account.voucher.rec_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_cash_pay_voucher">
<field name="name">Account Cash Payble Voucher</field>
<field name="code">account.voucher.pay_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_bank_rec_voucher">
<field name="name">Account Bank Received Voucher</field>
<field name="code">account.voucher.bank_rec_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_bank_pay_voucher">
<field name="name">Account Bank Payble Voucher</field>
<field name="code">account.voucher.bank_pay_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_contra_voucher">
<field name="name">Account Contra Voucher</field>
<field name="code">account.voucher.cont_voucher</field>
</record>
<record model="ir.sequence.type" id="seq_type_jou_sale_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">account.voucher.journal_sale_vou</field>
</record>
<record model="ir.sequence.type" id="seq_type_jou_pur_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">account.voucher.journal_pur_vou</field>
</record>
<!--
Sequences for vouchers
-->
<record model="ir.sequence" id="seq_cash_rec_voucher">
<field name="name">Account Cash Received Voucher</field>
<field name="code">account.voucher.rec_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_cash_pay_voucher">
<field name="name">Account Cash Payble Voucher</field>
<field name="code">account.voucher.pay_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_bank_rec_voucher">
<field name="name">Account Bank Received Voucher</field>
<field name="code">account.voucher.bank_rec_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_bank_pay_voucher">
<field name="name">Account Bank Payble Voucher</field>
<field name="code">account.voucher.bank_pay_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_contra_voucher">
<field name="name">Account Contra Voucher</field>
<field name="code">account.voucher.cont_voucher</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_jou_sale_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">account.voucher.journal_sale_vou</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_jou_pur_voucher">
<field name="name">Account Journal Voucher</field>
<field name="code">account.voucher.journal_pur_vou</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<!--
Sequences types for analytic account
<record model="ir.sequence.type" id="seq_type_analytic_account">
<field name="name">Analytic account</field>
<field name="code">account.analytic.account</field>
</record>
Sequence for analytic account
<record model="ir.sequence" id="seq_analytic_account">
<field name="name">Analytic account sequence</field>
<field name="code">account.analytic.account</field>
<field name="padding" eval="3" />
<field name="number_next" eval="2708" />
</record>
-->
</data>
</openerp>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<terp>
<data>
<wizard
id="wizard_account_voucher_open"
menu="False"
model="account.voucher"
name="account.voucher.open"
string="Open a Voucher Entry"
/>
<menuitem
action="wizard_account_voucher_open"
id="menu_wizard_account_voucher_open"
name="Financial Management/Voucher Entries/Open Vouchers"
sequence="0"
type="wizard"
/>
</data>
</terp>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<terp>
<data>
<record id="wkf_voucher" model="workflow">
<field name="name">account.voucher.basic</field>
<field name="osv">account.voucher</field>
<field name="on_create">True</field>
</record>
<record id="act_draft" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<record id="act_performa" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="name">performa</field>
<field name="action">open_voucher()</field>
<field name="kind">function</field>
</record>
<record id="act_posted" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="name">posted</field>
<field name="action">proforma_voucher()</field>
<field name="flow_stop">True</field>
<field name="kind">function</field>
</record>
<record id="act_cancel" model="workflow.activity">
<field name="wkf_id" ref="wkf_voucher"/>
<field name="name">cancel</field>
<field name="action">cancel_voucher()</field>
<field name="kind">function</field>
</record>
<record id="t1" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_performa"/>
<field name="signal">open_voucher</field>
</record>
<record id="t2" model="workflow.transition">
<field name="act_from" ref="act_performa"/>
<field name="act_to" ref="act_posted"/>
<field name="signal">proforma_voucher</field>
</record>
<record id="t3" model="workflow.transition">
<field name="act_from" ref="act_performa"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">cancel_voucher</field>
</record>
<record id="t5" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">cancel_voucher</field>
</record>
<record id="t6" model="workflow.transition">
<field name="act_from" ref="act_posted"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">cancel_voucher</field>
</record>
<record id="t7" model="workflow.transition">
<field name="act_from" ref="act_cancel"/>
<field name="act_to" ref="act_performa"/>
<field name="signal">open_voucher</field>
</record>
</data>
</terp>

View File

@ -0,0 +1,4 @@
import invoice
import tax_report
import report_voucher
import report_voucher_amount

View File

@ -0,0 +1,50 @@
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# 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 time
from report import report_sxw
class account_invoice_tax_retail(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_invoice_tax_retail, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'title': self.getTitle,
})
def getTitle(self, invoice):
title = '';
if invoice.retail_tax:
title = invoice.retail_tax[0].swapcase() + invoice.retail_tax[1:]
return title;
report_sxw.report_sxw(
'report.tax.retail.account.invoice',
'account.invoice',
'addons/india/account/report/invoice.rml',
parser=account_invoice_tax_retail,
)

View File

@ -0,0 +1,268 @@
<?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="Tableau2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<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"/>
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
<blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
</blockTableStyle>
<blockTableStyle id="Tableau7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tableau8">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Tableau3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<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="Tableau4">
<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"/>
</blockTableStyle>
<blockTableStyle id="Tableau5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P3" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P6" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P7" fontName="Times-Italic" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P8" fontName="Times-Roman" fontSize="16.0" leading="20" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P9" fontName="Times-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P10" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P11" fontName="Times-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P12" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
<paraStyle name="P13" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
<paraStyle name="P14" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
<paraStyle name="P15" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
<paraStyle name="P16" fontName="Times-Roman" fontSize="11.0" leading="14"/>
<paraStyle name="P17" fontName="Times-Roman" fontSize="11.0" leading="14"/>
<paraStyle name="P18" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
<paraStyle name="P19" fontName="Times-Roman" alignment="LEFT"/>
<paraStyle name="P20" fontName="Times-Roman"/>
<paraStyle name="P21" fontName="Times-Roman" fontSize="16.0" leading="20"/>
<paraStyle name="P22" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P23" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P24" fontName="Times-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.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>
<story>
<para style="P1">[[ repeatIn(objects,'o') ]]</para>
<para style="P1">[[ setLang(o.partner_id.lang) ]]</para>
<para style="P6">Subject to Ahmedabad jurisdiction</para>
<blockTable colWidths="281.0,246.0" style="Tableau2">
<tr>
<td>
<para style="P20">M/S.</para>
<para style="P21">[[ o.partner_id.title or '' ]][[ o.partner_id.name ]]</para>
<para style="Standard">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
<para style="Standard">[[ o.address_invoice_id.street ]]</para>
<para style="Standard">[[ o.address_invoice_id.street2 or '' ]]</para>
<para style="Standard">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
<para style="Standard">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
<para style="Standard">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="Standard">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
<para style="Standard">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
<para style="P19">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
</td>
<td>
<para style="Standard">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="P12">
<font color="white"> </font>
</para>
<para style="P15">[[ title(o)]] Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
<para style="P15">[[ title(o)]] PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P15">Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P15">[[ title(o)]] Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P15">[[ title(o)]] Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
<para style="P15">[[ title(o)]] Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
<para style="P14">
<font face="Times-Roman">[[ title(o)]] Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]]</font>
<font face="Times-Roman">[[ o.number ]]</font>
</para>
<para style="P13">
<font color="white"> </font>
</para>
<para style="P16">
<font face="Times-Roman">Document</font>
<font face="Times-Roman">:</font>
<font face="Times-Roman">[[o.name]]</font>
</para>
<para style="P16">
<font face="Times-Roman">Invoice Date: </font>
<font face="Times-Roman">[[o.date_invoice]]</font>
</para>
<para style="P17"><font face="Times-Roman">Customer Ref:</font> [[ o.address_invoice_id.partner_id.ref or '/' ]]</para>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="247.0,94.0,62.0,51.0,74.0" style="Table1">
<tr>
<td>
<para style="P4">Description</para>
</td>
<td>
<para style="P5">Quantity</para>
</td>
<td>
<para style="P5">Unit Price</para>
</td>
<td>
<para style="P5">Disc. (%)</para>
</td>
<td>
<para style="P5">Price</para>
</td>
</tr>
</blockTable>
<section>
<para style="P22">[[repeatIn(o.invoice_line,'l') ]]</para>
<blockTable colWidths="247.0,93.0,62.0,51.0,74.0" style="Tableau7">
<tr>
<td>
<para style="P8">[[ l.name ]]</para>
</td>
<td>
<para style="P2">[[ formatLang(l.quantity) ]] [[l.uos_id and l.uos_id.name or '' ]]</para>
</td>
<td>
<para style="P2">[[ formatLang(l.price_unit) ]]</para>
</td>
<td>
<para style="P2">[[ l.discount and formatLang (l.discount) or '' ]] </para>
</td>
<td>
<para style="P2">[[ formatLang(l.price_subtotal) ]] [[o.currency_id.code ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="28.0,499.0" style="Tableau8">
<tr>
<td>
<para style="P23">[[ repeatIn((l.note and l.note.splitlines()) or [], 'note') ]]</para>
<para style="P23">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P7">[[ note or removeParentNode('table') ]]</para>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="275.0,244.0" style="Tableau3">
<tr>
<td>
<blockTable colWidths="136.0,76.0,61.0" style="Tableau4">
<tr>
<td>
<para style="P3">Tax</para>
</td>
<td>
<para style="P2">Base</para>
</td>
<td>
<para style="P2">Amount</para>
</td>
</tr>
<tr>
<td>
<para style="P10"><font face="Times-Roman">[[ repeatIn(o.tax_line,'t') ]]</font> [[ t.name ]]</para>
</td>
<td>
<para style="P9">[[ formatLang(t.base) ]]</para>
</td>
<td>
<para style="P9">[[ formatLang(t.amount)]]</para>
</td>
</tr>
</blockTable>
</td>
<td>
<blockTable colWidths="115.0,122.0" style="Tableau5">
<tr>
<td>
<para style="P11">Total (excl. taxes):</para>
</td>
<td>
<para style="P11">[[ formatLang(o.amount_untaxed) ]] [[o.currency_id.code ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P11">Taxes:</para>
</td>
<td>
<para style="P11">[[ formatLang(o.amount_tax) ]] [[o.currency_id.code ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P11">Total (incl. taxes):</para>
</td>
<td>
<para style="P24">[[ formatLang(o.amount_total) ]] [[o.currency_id.code ]]</para>
</td>
</tr>
</blockTable>
<para style="Table Contents">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="P18">[[ format(o.comment or '') ]]</para>
<para style="P18">
<font color="white"> </font>
</para>
<para style="P18">[[ format((o.payment_term and o.payment_term.note) or '') ]]</para>
</story>
</document>

View File

@ -0,0 +1,72 @@
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# 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 time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'convert':self.convert,
'debit':self.debit,
'credit':self.credit,
'get_ref' : self._get_ref
})
def convert(self,amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
return amt_en
def debit(self, move_ids):
debit = 0.0
for move in move_ids:#self.pool.get('account.move.line').browse(self.cr, self.uid, move_ids):
debit +=move.debit
return debit
def credit(self, move_ids):
credit = 0.0
for move in move_ids:#self.pool.get('account.move.line').browse(self.cr, self.uid, move_ids):
credit +=move.credit
return credit
def _get_ref(self, voucher_id, move_ids):
voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)])
if voucher_line:
voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0]
return voucher.ref
else:
return
report_sxw.report_sxw(
'report.voucher.cash_receipt',
'account.voucher',
'addons/account_voucher/report/report_voucher.rml',
parser=report_voucher,header=False
)

View File

@ -0,0 +1,381 @@
<?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="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Heading1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="voucher_lines">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="last_info">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,7" stop="0,7"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,7" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,7" stop="1,7"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,7" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,7" stop="2,7"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="22.0" leading="27" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P14" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P16" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P17" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P18" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P19" fontName="Helvetica" fontSize="5.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P20" fontName="Helvetica" fontSize="5.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P21" fontName="Helvetica" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P22" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P23" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P24" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P25" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P26" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P27" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P28" rightIndent="0.0" leftIndent="15.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P30" rightIndent="0.0" leftIndent="20.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P31" rightIndent="0.0" leftIndent="25.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Italic" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Table Contents" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
</stylesheet>
<images/>
<story>
<para style="P26">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P4">[[ company.name ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].street ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].zip ]] [[ company.partner_id.address and company.partner_id.address[0].city ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].phone ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].email ]]</para>
<para style="P5">
<font color="white"> </font>
</para>
<para style="P24">Cash Receipt Voucher [[ (voucher.type == 'rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Cash Payment Voucher [[ (voucher.type == 'pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P24">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Bank Payment Voucher [[ (voucher.type == 'bank_pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P23">
<font color="white"> </font>
</para>
<blockTable colWidths="49.0,143.0,116.0,69.0,106.0" style="Table1">
<tr>
<td>
<para style="P10">No.</para>
</td>
<td>
<para style="P27">[[ voucher.number ]]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">Dated :</para>
</td>
<td>
<para style="P27">[[ time.strftime('%d %B,%Y', time.strptime(voucher.date , '%Y-%m-%d')) or '' ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P10">State :</para>
</td>
<td>
<para style="P25">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P25">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P25">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P25">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">Ref. :</para>
</td>
<td>
<para style="P27">[[ voucher.reference ]]</para>
</td>
</tr>
</blockTable>
<para style="P12">
<font color="white"> </font>
</para>
<para style="P12">
<font color="white"> </font>
</para>
<blockTable colWidths="255.0,114.0,114.0" style="Heading1">
<tr>
<td>
<para style="P14">Particulars</para>
</td>
<td>
<para style="P15">Debit</para>
</td>
<td>
<para style="P15">Credit</para>
</td>
</tr>
</blockTable>
<para style="P19"/>
<blockTable colWidths="482.0" style="voucher_lines">
<tr>
<td>
<para style="P20">[[ repeatIn(voucher.move_ids,'move_ids') ]] </para>
<blockTable colWidths="251.0,110.0,115.0" style="Table2">
<tr>
<td>
<para style="P11">[[ (move_ids.partner_id and move_ids.partner_id.name) or '']] :</para>
<para style="P28">[[ move_ids.account_id.name ]] </para>
<para style="P31">[[ get_ref(voucher.id,move_ids) ]]</para>
</td>
<td>
<para style="P21">[[ move_ids.debit ]]</para>
</td>
<td>
<para style="P21">[[ move_ids.credit ]]</para>
</td>
</tr>
</blockTable>
<para style="P22">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="253.0,114.0,114.0" style="last_info">
<tr>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P13">Through : </para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P30">[[ voucher.narration or '']]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P13">On Account of : </para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P30">[[ voucher.name ]]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P13">Amount (in words) : </para>
</td>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P30">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
</td>
<td>
<para style="P12">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P12">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P16">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P17">[[ debit(voucher.move_ids)]]</para>
</td>
<td>
<para style="P17">[[ credit(voucher.move_ids) ]]</para>
</td>
</tr>
</blockTable>
<para style="P18">
<font color="white"> </font>
</para>
<blockTable colWidths="142.0,99.0,105.0,136.0" style="Table3">
<tr>
<td>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P7">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P7">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P8">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P23">Receiver's Signature</para>
</td>
<td>
<para style="P23">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P23">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P23">Authorised Signatory</para>
</td>
</tr>
</blockTable>
<para style="P1">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -0,0 +1,51 @@
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# 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 time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher_amount(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher_amount, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'convert':self.convert
})
def convert(self,amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
return amt_en
report_sxw.report_sxw(
'report.voucher.cash_amount',
'account.voucher',
'addons/account_voucher/report/report_voucher_amount.rml',
parser=report_voucher_amount,header=False
)

View File

@ -0,0 +1,353 @@
<?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="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Heading1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="voucher_lines">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="last_info">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,7" stop="0,7"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,7" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,7" stop="1,7"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="22.0" leading="27" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P14" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P16" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P17" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P18" fontName="Helvetica" fontSize="5.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P19" fontName="Helvetica" fontSize="5.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P20" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P21" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P22" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P23" fontName="Helvetica-Bold" fontSize="13.0" leading="16" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P24" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P25" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P26" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P27" rightIndent="0.0" leftIndent="15.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P29" rightIndent="0.0" leftIndent="20.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P30" rightIndent="0.0" leftIndent="25.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Italic" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="Table Contents" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
</stylesheet>
<images/>
<story>
<para style="P25">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P4">[[ company.name ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].street ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].zip ]] [[ company.partner_id.address and company.partner_id.address[0].city ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].phone ]]</para>
<para style="P6">[[ company.partner_id.address and company.partner_id.address[0].email ]]</para>
<para style="P5">
<font color="white"> </font>
</para>
<para style="P23">Cash Receipt Voucher [[ (voucher.type == 'rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Cash Payment Voucher [[ (voucher.type == 'pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P23">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Bank Payment Voucher [[ (voucher.type == 'bank_pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P22">
<font color="white"> </font>
</para>
<blockTable colWidths="68.0,124.0,122.0,62.0,106.0" style="Table1">
<tr>
<td>
<para style="P10">No.</para>
</td>
<td>
<para style="P26">[[ voucher.number ]]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">Dated :</para>
</td>
<td>
<para style="P26">[[ time.strftime('%d %B,%Y', time.strptime(voucher.date , '%Y-%m-%d')) or '' ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P10">State :</para>
</td>
<td>
<para style="P24">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
<para style="P24">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
<para style="P24">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
<para style="P24">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">Ref. :</para>
</td>
<td>
<para style="P26">[[ voucher.reference ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P10">Account :</para>
</td>
<td>
<para style="P24">[[ voucher.account_id.name ]]</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P26">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="P12"/>
<para style="P12">
<font color="white"> </font>
</para>
<blockTable colWidths="333.0,149.0" style="Heading1">
<tr>
<td>
<para style="P14">Particulars</para>
</td>
<td>
<para style="P15">Amount</para>
</td>
</tr>
</blockTable>
<para style="P18">
<font color="white"> </font>
</para>
<blockTable colWidths="482.0" style="voucher_lines">
<tr>
<td>
<para style="P19">[[ repeatIn(voucher.payment_ids,'payment_ids') ]] </para>
<blockTable colWidths="324.0,152.0" style="Table6">
<tr>
<td>
<para style="P11">[[ payment_ids.partner_id.name ]] :</para>
<para style="P27">[[ payment_ids.account_id.name ]] </para>
<para style="P30">[[ payment_ids.ref ]] [[ payment_ids.amount ]] [[ payment_ids.type ]]</para>
</td>
<td>
<para style="P20">[[ payment_ids.amount ]]</para>
</td>
</tr>
</blockTable>
<para style="P21">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="344.0,138.0" style="last_info">
<tr>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P13">Through : </para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P29">[[ voucher.narration or '' ]] </para>
</td>
<td>
<para style="P26">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P13">On Account of : </para>
</td>
<td>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P29">[[ voucher.name ]]</para>
</td>
<td>
<para style="P26">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P13">Amount (in words) : </para>
</td>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P29">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
</td>
<td>
<para style="P12">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P12">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P16">[[ voucher.amount ]]</para>
</td>
</tr>
</blockTable>
<para style="P17">
<font color="white"> </font>
</para>
<blockTable colWidths="142.0,99.0,105.0,136.0" style="Table5">
<tr>
<td>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P7">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P7">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P8">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P22">Receiver's Signature</para>
</td>
<td>
<para style="P22">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P22">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P22">Authorised Signatory</para>
</td>
</tr>
</blockTable>
<para style="P1">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -0,0 +1,185 @@
##############################################################################
#
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# 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 time
import pooler
from report import report_sxw
class account_tax_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_tax_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
'get_invoice': self.getInvoices,
'add_invoice': self.addInvoice,
'get_tax': self.getTax,
'get_tax_detail' : self.getTaxDetail,
'get_retail' : self.getRetailTax,
'get_retail_detail' : self.getRetailTaxDetail,
'get_local_sale' : self.getLocalSale,
'get_retail_sale' : self.getRetailSale,
'total_local_sale' : self.getTotalLocalSale,
'total_local_tax' : self.getTotalLocalTax,
'total_retail_sale' : self.getTotalRetailSale,
'total_retail_tax' : self.getTotalRetailTax,
'time': time,
'get_period': self.getPeriod,
'test' : self.testMethod,
})
self.local = 0
self. retail = 0
self.tax_tax = {}
self.retail_tax = {}
self.sale_tax = {}
self.sale_retail = {}
self.total_local_sale = 0
self.total_local_tax = 0
self.total_retail_sale = 0
self.total_retail_tax = 0
self.invoices = []
self.flag = False
#end def
def getPeriod(self, period_id):
return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name
#end def
def testMethod(self, obj):
print type(obj) == type({}), obj;
if type(obj) == type({}) and not self.flag:
if obj.has_key('form'):
self.flag = True
ids = self.pool.get('account.move.line').search(self.cr, self.uid, [('period_id','=',obj['form']['period_id'])])
account = self.pool.get('account.move.line').read(self.cr, self.uid,ids,['invoice'])
invoice_ids = []
for i in account:
if i['invoice'][0]:
if not i['invoice'][0] in invoice_ids:
inv = self.pool.get('account.invoice').browse(self.cr, self.uid,i['invoice'][0])
if inv.type == 'out_invoice' and inv.state == 'open':
if not i['invoice'][0] in self.invoices:
print '*********************** : ',i['invoice'][0]
self.invoices.append(i['invoice'][0])
#end if
#end if
#end for
#end if
elif self.flag == False:
self.invoices = self.ids
#end if
#end def
def getInvoices(self):
print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>',self.invoices;
return self.pool.get('account.invoice').browse(self.cr, self.uid, self.invoices)
#end def
def addInvoice(self, invoice):
if invoice.retail_tax == 'tax':
self.total_local_sale += invoice.amount_untaxed
self.total_local_tax += invoice.amount_tax
for tax in invoice.tax_line:
if self.tax_tax.has_key(tax.name):
self.tax_tax[tax.name] += tax.tax_amount
self.sale_tax[tax.name] += tax.base_amount
else:
self.tax_tax[tax.name] = tax.tax_amount
self.sale_tax[tax.name] = tax.base_amount
#end for
elif invoice.retail_tax == 'retail':
self.total_retail_sale += invoice.amount_untaxed
self.total_retail_tax += invoice.amount_tax
self. retail += invoice.amount_total
for tax in invoice.tax_line:
if self.retail_tax.has_key(tax.name):
self.retail_tax[tax.name] += tax.tax_amount
self.sale_retail[tax.name] += tax.base_amount
else:
self.retail_tax[tax.name] = tax.tax_amount
self.sale_retail[tax.name] = tax.base_amount
#end if
#end for
#endif
#end def
def getTaxDetail(self, tax):
return self.tax_tax[tax];
def getTax(self):
tax = []
for i in self.tax_tax:
tax.append(i)
return tax
#end if
def getRetailTaxDetail(self, tax):
return self.retail_tax[tax];
def getRetailTax(self):
tax = []
for i in self.retail_tax:
tax.append(i)
return tax
#end if
def getLocalSale(self, tax):
return self.sale_tax[tax]
#end def
def getRetailSale(self, tax):
return self.sale_retail[tax]
#end def
def getTotalLocalSale(self):
return self.total_local_sale
#end def
def getTotalLocalTax(self):
return self.total_local_tax
#end def
def getTotalRetailSale(self):
return self.total_retail_sale
#end def
def getTotalRetailTax(self):
return self.total_retail_tax
#end def
#end class
report_sxw.report_sxw(
'report.indianvat.declaration',
'account.invoice',
'addons/india/account/report/tax_report.rml',
parser=account_tax_report,
)

View File

@ -0,0 +1,255 @@
<?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="44.0" y1="57.0" width="526" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
<blockBackground colorName="#e6e6ff" start="0,0" stop="0,0"/>
<blockBackground colorName="#e6e6ff" start="1,0" stop="1,0"/>
<blockBackground colorName="#e6e6ff" start="2,0" stop="2,0"/>
<blockBackground colorName="#e6e6ff" start="3,0" stop="3,0"/>
<blockBackground colorName="#e6e6ff" start="4,0" stop="4,0"/>
<blockBackground colorName="#e6e6ff" start="5,0" stop="5,0"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<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"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<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"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman"/>
<paraStyle name="P2" fontName="Times-Roman" fontSize="22.0" leading="27" alignment="CENTER"/>
<paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="P4" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER"/>
<paraStyle name="P5" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
<paraStyle name="P6" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P7" fontName="Times-Roman" fontSize="13.0" leading="16"/>
<paraStyle name="P8" fontName="Times-Roman"/>
<paraStyle name="P9" fontName="Times-Bold" fontSize="13.0" leading="16" alignment="CENTER"/>
<paraStyle name="P10" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="P11" fontName="Times-Roman" alignment="RIGHT"/>
<paraStyle name="P12" fontName="Times-Bold"/>
<paraStyle name="P13" fontName="Times-Bold" alignment="RIGHT"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<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="Caption" fontName="Times-Italic" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
</stylesheet>
<story>
<para style="P2">Sales Register for the Month of XXX-2007</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P6">Date : [[time.strftime('%Y-%m-%d')]] <font face="Times-Roman">at</font> [[ time.strftime('%H:%M:%S') ]]</para>
<para style="P1">[[ test(data) ]] [[ test(objects) ]]</para>
<blockTable colWidths="75.0,81.0,148.0,83.0,74.0,66.0" style="Table1">
<tr>
<td>
<para style="P9">Date</para>
</td>
<td>
<para style="P9">Invoice </para>
<para style="P9">No</para>
</td>
<td>
<para style="P9">Party Name</para>
</td>
<td>
<para style="P9">S.T.Req No</para>
</td>
<td>
<para style="P9">Invoice Amount</para>
</td>
<td>
<para style="P9">Tax. Amount</para>
</td>
</tr>
</blockTable>
<para style="P3">
<font color="white"> </font>
</para>
<blockTable colWidths="74.0,82.0,148.0,83.0,74.0,66.0" style="Table2">
<tr>
<td>
<para style="P8">[[repeatIn(get_invoice(),'o') ]]<font face="Times-Roman" size="2.0"/></para>
<para style="P8">[[ o.date_invoice ]] [[ add_invoice(o) ]]</para>
</td>
<td>
<para style="P8">[[ o.number ]]</para>
</td>
<td>
<para style="P8">[[ o.partner_id.name ]]</para>
</td>
<td>
<para style="P10">[[ o.partner_id.vat]]</para>
</td>
<td>
<para style="P11">[[ o.amount_total ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P11">[[ o.amount_tax ]] [[o.currency_id.code ]]</para>
</td>
</tr>
</blockTable>
<para style="P1">
<font color="white"> </font>
</para>
<para style="P5">Local Sale Report</para>
<blockTable colWidths="106.0,132.0,121.0,168.0" style="Table3">
<tr>
<td>
<para style="P9">Description</para>
</td>
<td>
<para style="P9">Invoice Amount</para>
</td>
<td>
<para style="P9">Tax Amount</para>
</td>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P8">[[ repeatIn(get_tax(),'t') ]]</para>
<para style="P8">[[ t ]]</para>
</td>
<td>
<para style="P11">[[ get_local_sale(t) ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P11">[[ get_tax_detail(t) ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P11">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="106.0,132.0,121.0,168.0" style="Table5">
<tr>
<td>
<para style="P12">TOTAL </para>
</td>
<td>
<para style="P13">[[ total_local_sale() ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P13">[[ total_local_tax() ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="P1">
<font color="white"> </font>
</para>
<para style="P5">Retail Sale Report</para>
<blockTable colWidths="104.0,134.0,121.0,168.0" style="Table4">
<tr>
<td>
<para style="P9">Description</para>
</td>
<td>
<para style="P9">Invoice Amount</para>
</td>
<td>
<para style="P9">Tax Amount</para>
</td>
<td>
<para style="P8">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P8">[[ repeatIn(get_retail(),'r') ]]</para>
<para style="P8">[[ r ]]</para>
</td>
<td>
<para style="P11">[[ get_retail_sale(r) ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P11">[[ get_retail_detail(r) ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P8">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="106.0,132.0,121.0,168.0" style="Table6">
<tr>
<td>
<para style="P12">TOTAL </para>
</td>
<td>
<para style="P13">[[ total_retail_sale() ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P13">[[ total_retail_tax() ]] [[o.currency_id.code ]]</para>
</td>
<td>
<para style="P13">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P7">For [[ company.name ]]</para>
<para style="P7">
<font color="white"> </font>
</para>
<para style="P7">[[ user.name ]]</para>
</story>
</document>

537
addons/account_voucher/voucher.py Executable file
View File

@ -0,0 +1,537 @@
import time
import netsvc
from osv import fields, osv
import ir
import pooler
import mx.DateTime
from mx.DateTime import RelativeDateTime
from tools import config
class account_voucher(osv.osv):
def _get_period(self, cr, uid, context):
periods = self.pool.get('account.period').find(cr, uid)
if periods:
return periods[0]
else:
return False
def _get_type(self, cr, uid, context={}):
type = context.get('type', 'rec_voucher')
return type
def _get_reference_type(self, cursor, user, context=None):
return [('none', 'Free Reference')]
def _get_journal(self, cr, uid, context):
type_inv = context.get('type', 'rec_voucher')
type2journal = {'rec_voucher': 'cash', 'bank_rec_voucher': 'cash','pay_voucher': 'cash','bank_pay_voucher': 'cash', 'cont_voucher': 'cash','journal_sale_voucher': 'sale','journal_pur_voucher': 'purchase' }
journal_obj = self.pool.get('account.journal')
res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'cash'))], limit=1)
if res:
return res[0]
else:
return False
def _get_currency(self, cr, uid, context):
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0]
if user.company_id:
return user.company_id.currency_id.id
else:
return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "number"
_columns = {
'name':fields.char('Name', size=256, required=True, readonly=True, states={'draft':[('readonly',False)]}),
'type': fields.selection([
('pay_voucher','Cash Payment Voucher'),
('bank_pay_voucher','Bank Payment Voucher'),
('rec_voucher','Cash Receipt Voucher'),
('bank_rec_voucher','Bank Receipt Voucher'),
('cont_voucher','Contra Voucher'),
('journal_sale_vou','Journal Sale Voucher'),
('journal_pur_voucher','Journal Purchase Voucher'),
],'Type', readonly=True, select=True),
'date':fields.date('Date', readonly=True, states={'draft':[('readonly',False)]}),
'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'payment_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=False, states={'proforma':[('readonly',True)]}),
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state':fields.selection(
[('draft','Draft'),
('proforma','Pro-forma'),
('posted','Posted'),
('cancel','Cancel')
], 'State',
readonly=True),
'amount':fields.float('Amount', readonly=True),
# , states={'draft':[('readonly',False)]}
'number':fields.char('Number', size=32, readonly=True),
'reference': fields.char('Voucher Reference', size=64),
'reference_type': fields.selection(_get_reference_type, 'Reference Type',
required=True),
'move_id':fields.many2one('account.move', 'Account Entry'),
'move_ids':fields.many2many('account.move.line', 'voucher_id', 'account_id', 'rel_account_move', 'Real Entry'),
}
# def get_bank(self, cr, uid, context={}):
# type = context.get('type', 'bank_payment')
# journal = self.pool.get('account.journal')
# if type == 'bank_payment':
# id = journal.search(cr, uid, [('name','ilike','Bank')])
# return id
# elif type == 'cash_payment':
# id = journal.search(cr, uid, [('name','ilike','Cash')])
# return id
#
# return 3
_defaults = {
#'journal_id':get_bank,
'state': lambda *a: 'draft',
'date' : lambda *a: time.strftime('%Y-%m-%d'),
'period_id': _get_period,
'type': _get_type,
'reference_type': lambda *a: 'none',
'journal_id':_get_journal,
'company_id': lambda self, cr, uid, context: \
self.pool.get('res.users').browse(cr, uid, uid,
context=context).company_id.id,
'currency_id': _get_currency,
}
def _get_analityc_lines(self, cr, uid, id):
inv = self.browse(cr, uid, [id])[0]
cur_obj = self.pool.get('res.currency')
def onchange_account(self, cr, uid, ids, account_id):
if not account_id:
return {'value':{'amount':False}}
account = self.pool.get('account.account').browse(cr,uid,account_id)
balance=account.balance
return {'value':{'amount':balance}}
def onchange_journal(self, cr, uid, ids, journal_id,type):
if not journal_id:
return {'value':{'account_id':False}}
journal = self.pool.get('account.journal')
if journal_id and (type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher')):
account_id = journal.browse(cr, uid, journal_id).default_debit_account_id
return {'value':{'account_id':account_id.id}}
elif journal_id and (type in ('pay_voucher','bank_pay_voucher','journal_sale_vou')) :
account_id = journal.browse(cr, uid, journal_id).default_credit_account_id
return {'value':{'account_id':account_id.id}}
else:
account_id = journal.browse(cr, uid, journal_id).default_credit_account_id
return {'value':{'account_id':account_id.id}}
def open_voucher(self, cr, uid, ids, context={}):
obj=self.pool.get('account.voucher').browse(cr,uid,ids)
total=0
for i in obj[0].payment_ids:
total+=i.amount
self.write(cr,uid,ids,{'amount':total})
self.write(cr, uid, ids, {'state':'proforma'})
return True
def proforma_voucher(self, cr, uid, ids, context={}):
self.action_move_line_create(cr, uid, ids)
self.action_number(cr, uid, ids)
self.write(cr, uid, ids, {'state':'posted'})
return True
def cancel_voucher(self,cr,uid,ids,context={}):
self.action_cancel(cr, uid, ids)
self.write(cr, uid, ids, {'state':'cancel'})
return True
def action_cancel_draft(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state':'draft'})
return True
def unlink(self, cr, uid, ids):
vouchers = self.read(cr, uid, ids, ['state'])
unlink_ids = []
for t in vouchers:
if t['state'] in ('draft', 'cancel'):
unlink_ids.append(t['id'])
else:
raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !')
osv.osv.unlink(self, cr, uid, unlink_ids)
return True
def _get_analityc_lines(self, cr, uid, id):
inv = self.browse(cr, uid, [id])[0]
cur_obj = self.pool.get('res.currency')
company_currency = inv.company_id.currency_id.id
if inv.type in ('rec_voucher'):
sign = 1
else:
sign = -1
iml = self.pool.get('account.voucher.line').move_line_get(cr, uid, inv.id)
for il in iml:
if il['account_analytic_id']:
if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
ref = inv.reference
else:
ref = self._convert_ref(cr, uid, inv.number)
il['analytic_lines'] = [(0,0, {
'name': il['name'],
'date': inv['date'],
'account_id': il['account_analytic_id'],
'amount': inv['amount'] * sign,
'partner_id': il['partner_id'] or False,
'general_account_id': il['account_id'] or False,
'journal_id': self._get_journal(cr, uid, inv.type),
'ref': ref,
})]
return iml
def action_move_line_create(self, cr, uid, ids, *args):
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
company_currency = inv.company_id.currency_id.id
# create the analytical lines
line_ids = self.read(cr, uid, [inv.id], ['payment_ids'])[0]['payment_ids']
ils = self.pool.get('account.voucher.line').read(cr, uid, line_ids)
# one move line per invoice line
iml = self._get_analityc_lines(cr, uid, inv.id)
# check if taxes are all computed
diff_currency_p = inv.currency_id.id <> company_currency
# create one move line for the total and possibly adjust the other lines amount
total = 0
if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
ref = inv.reference
else:
ref = self._convert_ref(cr, uid, inv.number)
date = inv.date
total_currency = 0
for i in iml:
if inv.currency_id.id != company_currency:
i['currency_id'] = inv.currency_id.id
i['amount_currency'] = i['amount']
else:
i['amount_currency'] = False
i['currency_id'] = False
i['ref'] = ref
if inv.type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher'):
total += i['amount']
total_currency += i['amount_currency'] or i['amount']
i['amount'] = - i['amount']
else:
total -= i['amount']
total_currency -= i['amount_currency'] or i['amount']
acc_id = inv.account_id.id
name = inv['name'] or '/'
totlines = False
iml.append({
'type': 'dest',
'name': name,
'amount': total,
'account_id': acc_id,
'amount_currency': diff_currency_p \
and total_currency or False,
'currency_id': diff_currency_p \
and inv.currency_id.id or False,
'ref': ref
})
date = inv.date
inv.amount=total
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x,date, context={})) ,iml)
journal_id = inv.journal_id.id #self._get_journal(cr, uid, {'type': inv['type']})
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
if journal.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
move = {'name': name, 'line_id': line, 'journal_id': journal_id}
if inv.period_id:
move['period_id'] = inv.period_id.id
for i in line:
i[2]['period_id'] = inv.period_id.id
move_id = self.pool.get('account.move').create(cr, uid, move)
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id})
obj=self.pool.get('account.move').browse(cr,uid,move_id)
for line in obj.line_id :
cr.execute('insert into voucher_id (account_id,rel_account_move) values (%d, %d)',(int(ids[0]),int(line.id)))
# self.pool.get('account.move').post(cr, uid, [move_id])
# self._log_event(cr, uid, ids)
return True
def line_get_convert(self, cr, uid, x, date, context={}):
return {
'date':date,
'date_maturity': x.get('date_maturity', False),
'partner_id':x.get('partner_id',False),
'name':x['name'][:64],
'debit':x['amount']>0 and x['amount'],
'credit':x['amount']<0 and -x['amount'],
'account_id':x['account_id'],
'analytic_lines':x.get('analytic_lines', []),
'amount_currency':x.get('amount_currency', False),
'currency_id':x.get('currency_id', False),
'tax_code_id': x.get('tax_code_id', False),
'tax_amount': x.get('tax_amount', False),
'ref':x.get('ref',False)
}
def _convert_ref(self, cr, uid, ref):
return (ref or '').replace('/','')
def action_number(self, cr, uid, ids, *args):
cr.execute('SELECT id, type, number, move_id, reference ' \
'FROM account_voucher ' \
'WHERE id IN ('+','.join(map(str,ids))+')')
for (id, invtype, number, move_id, reference) in cr.fetchall():
if not number:
number = self.pool.get('ir.sequence').get(cr, uid,
'account.voucher.' + invtype)
if type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
ref = reference
else:
ref = self._convert_ref(cr, uid, number)
cr.execute('UPDATE account_voucher SET number=%s ' \
'WHERE id=%d', (number, id))
cr.execute('UPDATE account_move_line SET ref=%s ' \
'WHERE move_id=%d AND (ref is null OR ref = \'\')',
(ref, move_id))
cr.execute('UPDATE account_analytic_line SET ref=%s ' \
'FROM account_move_line ' \
'WHERE account_move_line.move_id = %d ' \
'AND account_analytic_line.move_id = account_move_line.id',
(ref, move_id))
return True
def name_get(self, cr, uid, ids, context={}):
if not len(ids):
return []
types = {
'pay_voucher': 'CPV: ',
'rec_voucher': 'CRV: ',
'cont_voucher': 'CV: ',
'bank_pay_voucher': 'BPV: ',
'bank_rec_voucher': 'BRV: ',
'journal_sale_vou': 'JSV: ',
'journal_pur_voucher': 'JPV: ',
}
return [(r['id'], types[r['type']]+(r['number'] or '')+' '+(r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if not args:
args=[]
if not context:
context={}
ids = []
if name:
ids = self.search(cr, user, [('number','=',name)]+ args, limit=limit, context=context)
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
return self.name_get(cr, user, ids, context)
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
default = default.copy()
default.update({'state':'draft', 'number':False, 'move_id':False, 'move_ids':False})
if 'date' not in default:
default['date'] = time.strftime('%Y-%m-%d')
return super(account_voucher, self).copy(cr, uid, id, default, context)
def action_cancel(self, cr, uid, ids, *args):
account_move_obj = self.pool.get('account.move')
voucher = self.read(cr, uid, ids, ['move_id'])
for i in voucher:
if i['move_id']:
account_move_obj.button_cancel(cr, uid, [i['move_id'][0]])
# delete the move this invoice was pointing to
# Note that the corresponding move_lines and move_reconciles
# will be automatically deleted too
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
# self._log_event(cr, uid, ids,-1.0, 'Cancel Invoice')
return True
account_voucher()
class VoucherLine(osv.osv):
_name = 'account.voucher.line'
_description = 'Voucher Line'
_columns = {
'voucher_id':fields.many2one('account.voucher', 'Voucher'),
'name':fields.char('Description', size=256, required=True),
'account_id':fields.many2one('account.account','Account', required=True),
'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, required=True, ),
'amount':fields.float('Amount'),
'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Type'),
'ref':fields.char('Ref.', size=32),
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account')
}
_defaults = {
'type': lambda *a: 'cr'
}
def move_line_get(self, cr, uid, voucher_id, context={}):
res = []
cur_obj = self.pool.get('res.currency')
inv = self.pool.get('account.voucher').browse(cr, uid, voucher_id)
company_currency = inv.company_id.currency_id.id
cur = inv.currency_id
for line in inv.payment_ids:
res.append(self.move_line_get_item(cr, uid, line, context))
return res
def onchange_partner(self, cr, uid, ids, partner_id, type,type1):
if not partner_id:
return {'value' : {'account_id' : False, 'type' : False ,'amount':False}}
obj = self.pool.get('res.partner')
account_id = False
if type1 in ('rec_voucher','bank_rec_voucher'):
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
balance=obj.browse(cr,uid,partner_id).credit
type = 'cr'
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
account_id = obj.browse(cr, uid, partner_id).property_account_payable
balance=obj.browse(cr,uid,partner_id).debit
type = 'dr'
elif type1 in ('journal_sale_vou') :
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
balance=obj.browse(cr,uid,partner_id).credit
type = 'dr'
elif type1 in ('journal_pur_vou') :
account_id = obj.browse(cr, uid, partner_id).property_account_payable
balance=obj.browse(cr,uid,partner_id).debit
type = 'cr'
return {
'value' : {'account_id' : account_id.id, 'type' : type, 'amount':balance}
}
def onchange_amount(self, cr, uid, ids,partner_id,amount, type,type1):
if not amount:
return {'value' : {'type' : False}}
obj = self.pool.get('res.partner')
if type1 in ('rec_voucher','bank_rec_voucher'):
if amount < 0 :
account_id = obj.browse(cr, uid, partner_id).property_account_payable
type = 'dr'
else:
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
type = 'cr'
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
if amount < 0 :
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
type = 'cr'
else:
account_id = obj.browse(cr, uid, partner_id).property_account_payable
type = 'dr'
elif type1 in ('journal_sale_vou') :
if amount < 0 :
account_id = obj.browse(cr, uid, partner_id).property_account_payable
type = 'cr'
else:
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
type = 'dr'
elif type1 in ('journal_pur_vou') :
if amount< 0 :
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
type = 'dr'
else:
account_id = obj.browse(cr, uid, partner_id).property_account_payable
type = 'cr'
return {
'value' : { 'type' : type , 'amount':amount}
}
def onchange_type(self, cr, uid, ids,partner_id,amount,type,type1):
if not partner_id:
return {'value' : {'type' : False}}
obj = self.pool.get('res.partner')
if type1 in ('rec_voucher','bank_rec_voucher'):
if type == 'dr' :
account_id = obj.browse(cr, uid, partner_id).property_account_payable
total=amount*(-1)
else:
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
total=amount*1
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
if type == 'cr' :
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
amount*=-1
else:
account_id = obj.browse(cr, uid, partner_id).property_account_payable
amount*=1
elif type1 in ('journal_sale_vou') :
if type == 'cr' :
account_id = obj.browse(cr, uid, partner_id).property_account_payable
amount*=-1
else:
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
amount*=1
elif type1 in ('journal_pur_vou') :
if type == 'dr' :
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
amount*=-1
else:
account_id = obj.browse(cr, uid, partner_id).property_account_payable
amount*=1
return {
'value' : {'type' : type , 'amount':total}
}
def move_line_get_item(self, cr, uid, line, context={}):
return {
'type':'src',
'name': line.name[:64],
'amount':line.amount,
'account_id':line.account_id.id,
'partner_id':line.partner_id.id or False ,
'account_analytic_id':line.account_analytic_id.id or False,
}
VoucherLine()

View File

@ -0,0 +1,125 @@
import time
import netsvc
from osv import fields, osv
import ir
import pooler
import mx.DateTime
from mx.DateTime import RelativeDateTime
from tools import config
class Account(osv.osv):
_inherit = "account.account"
def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''):
#compute the balance/debit/credit accordingly to the value of field_name for the given account ids
mapping = {
'balance': "COALESCE(SUM(l.debit) - SUM(l.credit) , 0) as balance ",
'debit': "COALESCE(SUM(l.debit), 0) as debit ",
'credit': "COALESCE(SUM(l.credit), 0) as credit "
}
#get all the necessary accounts
ids2 = self._get_children_and_consol(cr, uid, ids, context)
acc_set = ",".join(map(str, ids2))
#compute for each account the balance/debit/credit from the move lines
accounts = {}
if ids2:
query = self.pool.get('account.move.line')._query_get(cr, uid,
context=context)
cr.execute(("SELECT l.account_id as id, " +\
' , '.join(map(lambda x: mapping[x], field_names)) +
"FROM " \
"account_move_line l " \
"WHERE " \
"l.account_id IN (%s) " \
"AND " + query + " " \
"GROUP BY l.account_id") % (acc_set, ))
for res in cr.dictfetchall():
accounts[res['id']] = res
#for the asked accounts, get from the dictionnary 'accounts' the value of it
res = {}
for id in ids:
res[id] = self._get_account_values(cr, uid, id, accounts, field_names, context)
for id in ids:
open=self.browse(cr, uid, id, context)
type_id=open.user_type
obj=self.pool.get('account.account.type').browse(cr,uid,type_id.id)
open_balance=open.open_bal
if obj.code in ('cash','asset','expense'):
res[id]['balance']+=open_balance
elif obj.code in ('equity','income','liability'):
total=open_balance*(-1)
res[id]['balance']+=total
else:
res[id]=res[id]
return res
def _get_account_values(self, cr, uid, id, accounts, field_names, context={}):
res = {}.fromkeys(field_names, 0.0)
browse_rec = self.browse(cr, uid, id)
if browse_rec.type == 'consolidation':
ids2 = self.read(cr, uid, [browse_rec.id], ['child_consol_ids'], context)[0]['child_consol_ids']
for t in self.search(cr, uid, [('parent_id', 'child_of', [browse_rec.id])]):
if t not in ids2 and t != browse_rec.id:
ids2.append(t)
for i in ids2:
tmp = self._get_account_values(cr, uid, i, accounts, field_names, context)
for a in field_names:
res[a] += tmp[a]
else:
ids2 = self.search(cr, uid, [('parent_id', 'child_of', [browse_rec.id])])
for i in ids2:
for a in field_names:
res[a] += accounts.get(i, {}).get(a, 0.0)
return res
def _diff(self, cr, uid, ids, field_name, arg, context={}):
res={}
dr_total=0.0
cr_total=0.0
difference=0.0
for id in ids:
open=self.browse(cr, uid, id, context)
if open.type1 == 'dr':
dr_total+=open.open_bal
elif open.type1 == 'cr':
cr_total+=open.open_bal
else:
difference=0.0
difference=dr_total-cr_total
for id in ids:
res[id]=difference
return res
_columns = {
'open_bal' : fields.float('Opening Balance',digits=(16,2)),
'diff' : fields.function(_diff, digits=(16,2),method=True,string='Difference of Opening Bal.'),
'type1':fields.selection([('dr','Debit'),('cr','Credit'),('none','None')], 'Dr/Cr',store=True),
'balance': fields.function(__compute, digits=(16,2), method=True, string='Closing Balance', multi='balance'),
'credit': fields.function(__compute, digits=(16,2), method=True, string='Credit', multi='balance'),
'debit': fields.function(__compute, digits=(16,2), method=True, string='Debit', multi='balance'),
}
def onchange_type(self, cr, uid, ids,user_type,type1):
obj=self.pool.get('account.account.type').browse(cr,uid,user_type)
account_type=obj.code
if not account_type:
return {'value' : {}}
if account_type in ('cash','asset','expense'):
type1 = 'dr'
elif account_type in ('equity','income','liability') :
type1 = 'cr'
else:
type1 = 'none'
return {
'value' : {'type1' : type1}
}
Account()

View File

@ -0,0 +1,295 @@
<?xml version="1.0" encoding="UTF-8"?>
<terp>
<data>
<record model="ir.ui.view" id="view_voucher_tree">
<field name="name">account.voucher.tree</field>
<field name="model">account.voucher</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Vouchers">
<field name="name"/>
<field name="journal_id"/>
<field name="account_id" />
<field name="amount"/>
<field name="date"/>
<field name="period_id"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_form">
<field name="name">account.voucher.form</field>
<field name="model">account.voucher</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Voucher">
<notebook>
<page string="Entry">
<field name="number"/>
<field name="type" select="2" on_change="onchange_journal(journal_id,type)"/>
<field name="name" select="1"/>
<field name="journal_id" select="1" on_change="onchange_journal(journal_id,type)"/>
<field name="account_id" select="2" on_change="onchange_account(account_id)"/>
<field name="amount" select="1" required="1"/>
<newline/>
<field name="payment_ids" colspan="4" nolabel="1">
<tree string="Voucher Lines" editable="top">
<field name="partner_id" on_change="onchange_partner(partner_id,type,parent.type)"/>
<field name="account_id" groups="base.group_system"/>
<field name="name" groups="base.group_system"/>
<field name="ref"/>
<field name="amount"/>
<field name="type"/>
</tree>
</field>
<separator string="Narration" colspan="4"/>
<field name="narration" colspan="4" nolabel="1"/>
<group col="6" colspan="6">
<field name="state"/>
<button name="open_voucher" string="Pro-forma" states="draft" type="object"/>
<button name="proforma_voucher" string="Create" states="proforma" type="object"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma,posted" type="object"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
</group>
</page>
<page string="Other Info">
<field name="company_id" select="1"/>
<field name="reference_type" select="2" nolabel="1" size="0"/>
<field name="reference" select="1" nolabel="1"/>
<field name="currency_id" select="1" />
<field name="period_id"/>
<field name="date" select="1"/>
<field name="move_ids" colspan="4" nolabel="1" readonly="1"/>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_voucher_list">
<field name="name">Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
</record>
<menuitem name="Financial Management/Voucher Entries"
id="menu_action_voucher_list" action="action_voucher_list"/>
<!-- Receipt Vouchers -->
<record model="ir.actions.act_window" id="action_receipt_vou_voucher_list">
<field name="name">Receipt Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','like','rec_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers"
id="menu_action_receipt_vou_voucher_list" action="action_receipt_vou_voucher_list"/>
<record model="ir.actions.act_window" id="action_receipt_cashreceipt_voucher_list">
<field name="name">Cash Receipt</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','rec_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Cash Receipts"
id="menu_action_receipt_cashreceipt_voucher_list" action="action_receipt_cashreceipt_voucher_list"/>
<record model="ir.actions.act_window" id="action_draft_cash_rec_voucher_form">
<field name="name">Cash Receipt Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','rec_voucher'),('state','=','draft')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Cash Receipts/Draf Cash Receipt"
id="menu_action_draft_cash_rec_voucher_form" action="action_draft_cash_rec_voucher_form"/>
<record model="ir.actions.act_window" id="action_performa_cash_rec_voucher_form">
<field name="name">Cash Receipt Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','rec_voucher'),('state','=','proforma')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Cash Receipts/Pro-forma Cash Receipt"
id="menu_action_performa_cash_rec_voucher_form" action="action_performa_cash_rec_voucher_form"/>
<record model="ir.actions.act_window" id="action_posted_cash_rec_voucher_form">
<field name="name">Cash Receipt Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','rec_voucher'),('state','=','posted')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Cash Receipts/Posted Cash Receipt"
id="menu_action_posted_cash_rec_voucher_form" action="action_posted_cash_rec_voucher_form"/>
<record model="ir.actions.act_window" id="action_cancel_cash_rec_voucher_form">
<field name="name">Cash Receipt Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','rec_voucher'),('state','=','cancel')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Cash Receipts/Cancel Cash Receipt"
id="menu_action_cancel_cash_rec_voucher_form" action="action_cancel_cash_rec_voucher_form"/>
<record model="ir.actions.act_window" id="action_view_cash_rec_voucher_form">
<field name="name">Cash Receipt Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
<field name="domain">[('type','=','rec_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Cash Receipts/New Cash Receipt" id="menu_action_view_cash_rec_voucher_form" action="action_view_cash_rec_voucher_form"/>
<record model="ir.actions.act_window" id="action_receipt_bakreceipt_voucher_list">
<field name="name">Bank Receipt</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','bank_rec_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Bank Receipts"
id="menu_action_receipt_bakreceipt_voucher_list" action="action_receipt_bakreceipt_voucher_list"/>
<record model="ir.actions.act_window" id="action_view_bank_rec_voucher_form">
<field name="name">Bank Receipt Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
<field name="domain">[('type','=','bank_rec_voucher')]</field>
<field name="context">{'type':'bank_rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Receipt Vouchers/Bank Receipts/New Bank Receipt" id="menu_action_view_bank_rec_voucher_form" action="action_view_bank_rec_voucher_form"/>
<!-- End Receipt Vouchers -->
<!-- Payment Vouchers -->
<record model="ir.actions.act_window" id="action_payments_voucher_list">
<field name="name">Payment Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','like','pay_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Payment Vouchers"
id="menu_action_payments_voucher_list" action="action_payments_voucher_list"/>
<record model="ir.actions.act_window" id="action_payments_cashpay_voucher_list">
<field name="name">Payment Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','pay_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Payment Vouchers/Cash Payments"
id="menu_action_payments_cashpay_voucher_list" action="action_payments_cashpay_voucher_list"/>
<record model="ir.actions.act_window" id="action_view_cash_pay_voucher_form">
<field name="name">Cash Payment Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
<field name="domain">[('type','=','pay_voucher')]</field>
<field name="context">{'type':'pay_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Payment Vouchers/Cash Payments/New Cash Payment" id="menu_action_view_cash_pay_voucher_form" action="action_view_cash_pay_voucher_form"/>
<record model="ir.actions.act_window" id="action_payments_bankpay_voucher_list">
<field name="name">Payment Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('type','=','bank_pay_voucher')]</field>
<field name="context">{'type':'rec_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Payment Vouchers/Bank Payments"
id="menu_action_payments_bankpay_voucher_list" action="action_payments_bankpay_voucher_list"/>
<record model="ir.actions.act_window" id="action_view_bank_pay_voucher_form">
<field name="name">Bank Payment Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
<field name="domain">[('type','=','bank_pay_voucher')]</field>
<field name="context">{'type':'bank_pay_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Payment Vouchers/Bank Payments/New Bank Payment" id="menu_action_view_bank_pay_voucher_form" action="action_view_bank_pay_voucher_form"/>
<!-- End Payment Vouchers -->
<!-- Other Voucher Enries -->
<record model="ir.actions.act_window" id="action_other_voucher_list">
<field name="name">Other Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
</record>
<menuitem name="Financial Management/Voucher Entries/Other Vouchers"
id="menu_action_other_voucher_list" action="action_other_voucher_list"/>
<record model="ir.actions.act_window" id="action_view_cont_voucher_form">
<field name="name">Contra Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
<field name="domain">[('type','=','cont_voucher')]</field>
<field name="context">{'type':'cont_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Other Vouchers/Contra Voucher" id="menu_action_view_cont_voucher_form" action="action_view_cont_voucher_form"/>
<record model="ir.actions.act_window" id="action_view_jour_sale_voucher_form">
<field name="name">Journal Sale Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
<field name="domain">[('type','=','journal_sale_voucher')]</field>
<field name="context">{'type':'journal_sale_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Other Vouchers/Journal Sale Voucher" id="menu_action_view_jour_sale_voucher_form" action="action_view_jour_sale_voucher_form"/>
<record model="ir.actions.act_window" id="action_view_jour_pur_voucher_form">
<field name="name">Journal Purchase Voucher</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
<field name="domain">[('type','=','journal_pur_voucher')]</field>
<field name="context">{'type':'journal_pur_voucher'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Other Vouchers/Journal Purchase Voucher" id="menu_action_view_jour_pur_voucher_form" action="action_view_jour_pur_voucher_form"/>
</data>
</terp>

View File

@ -0,0 +1 @@
import open_voucher

View File

@ -0,0 +1,113 @@
# -*- 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 wizard
from tools.translate import _
import pooler
_voucher_form = '''<?xml version="1.0"?>
<form string="Open Vouchers">
<field name="type"/>
<field name="state"/>
<field name="period_ids" colspan="4"/>
</form>'''
_types = {
'pay_voucher':'Cash Payment Voucher',
'bank_pay_voucher':'Bank Payment Voucher',
'rec_voucher':'Cash Receipt Voucher',
'bank_rec_voucher':'Bank Receipt Voucher',
'cont_voucher':'Contra Voucher',
'journal_sale_voucher':'Journal Sale Voucher',
'journal_pur_voucher':'Journal Purchase Voucher'
}
_states = {
'draft':'Draft',
'proforma':'Pro-forma',
'posted':'Posted',
'cancel':'Cancel'
}
_voucher_fields = {
'type': {'string':'Voucher Type', 'type':'selection', 'selection':[
('pay_voucher','Cash Payment Voucher'),
('bank_pay_voucher','Bank Payment Voucher'),
('rec_voucher','Cash Receipt Voucher'),
('bank_rec_voucher','Bank Receipt Voucher'),
('cont_voucher','Contra Voucher'),
('journal_sale_voucher','Journal Sale Voucher'),
('journal_pur_voucher','Journal Purchase Voucher')], 'required':True},
'state': {'string':'State', 'type':'selection', 'selection':[
('draft','Draft'),
('proforma','Pro-forma'),
('posted','Posted'),
('cancel','Cancel')], 'required':True},
'period_ids': {'string':'Periods', 'type':'many2many', 'relation':'account.period'},
}
def _action_open_window(self, cr, uid, data, context):
form = data['form']
periods = []
if not form['period_ids'][0][2]:
pool = pooler.get_pool(cr.dbname)
period = pool.get('account.period')
year = pool.get('account.fiscalyear')
year = year.find(cr, uid)
periods = period.search(cr, uid, [('fiscalyear_id','=',year)])
else:
periods = form['period_ids'][0][2]
return {
'domain': "[('type','=','%s'), ('state','=','%s'), ('period_id','in',%s)]" % (form['type'], form['state'], periods),
'name': "%s - %s" % (_types[form['type']], _states[form['state']]),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.voucher',
'view_id': False,
'context': "{'type':'%s', 'state':'%s', 'period_id':%s}" % (form['type'], form['state'], periods),
'type': 'ir.actions.act_window'
}
class OpenVoucherEntries(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':_voucher_form, 'fields':_voucher_fields, 'state':[('end','Cancel'),('open','Open Voucher Entries')]}
},
'open': {
'actions': [],
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
}
}
OpenVoucherEntries('account.voucher.open')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: