bzr revid: pinky-fdcbe9f70bfbdc5b4f528886b4e9bfd7d6b30778
This commit is contained in:
pinky 2007-01-16 08:17:35 +00:00
parent ffbb29bffd
commit 1ed668755f
3 changed files with 2 additions and 286 deletions

View File

@ -26,4 +26,5 @@
#
##############################################################################
import bvr
import report
import wizard

View File

@ -1,64 +0,0 @@
##############################################################################
#
# 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_bvr(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_invoice_bvr, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'user':self.pool.get("res.users").browse(cr,uid,uid),
'mod10r': self._mod10r,
})
def _mod10r(self,nbr):
"""
Input arg : account or invoice number
Output return: the same number completed with the recursive mod10
key
"""
codec=[0,9,4,6,8,2,7,1,3,5]
report = 0
result=""
for chiffre in nbr:
if not chiffre.isdigit():
continue
report = codec[ (int(chiffre) +report) % 10 ]
result += chiffre
return result + str((10-report) % 10)
report_sxw.report_sxw(
'report.l10n_ch.bvr',
'account.invoice',
'addons/l10n_ch/bvr/bvr.rml',
parser=account_invoice_bvr,
header=False)

View File

@ -1,221 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<docinit>
<registerFont fontName="ocrb" fontFile="addons/l10n_ch/bvr/ocrbb.ttf"/>
</docinit>
<template pageSize="(210mm,297mm)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="34.0" y1="110mm" width="527" height="162mm"/>
<frame id="Frame1"
x1="2.5mm"
y1="0.5mm"
width="200mm"
height="111mm"/>
<!--
<frame id="Frame1" x1="[[ '%.2f' % (14.5 + user.company_id.bvr_delta_horz or 0.0) ]]mm" y1="[[ '%.2f' % (4.5 + user.company_id.bvr_delta_vert or 0.0) ]]mm" width="200mm" height="111mm"/>
-->
</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="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman" fontSize="11.0" leading="14"/>
<paraStyle name="P2" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
<paraStyle name="PBVR" fontName="ocrb" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P6" fontName="ocrb" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P7" fontName="Courier-Bold" fontSize="12.0" leading="15" alignment="LEFT"/>
<paraStyle name="P8" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P9" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P10" fontName="Times-Roman" fontSize="11.0" leading="14"/>
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14" 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="Frame contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
</stylesheet>
<story>
<para style="P8">[[ repeatIn(objects,'o') ]]<font face="Times-Roman">[[ setLang(o.partner_id.lang) ]]</font></para>
<blockTable colWidths="264.0,264.0" style="Table2">
<tr>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P10">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="P10">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
<para style="P10">[[ o.address_invoice_id.street ]]</para>
<para style="P10">[[ o.address_invoice_id.street2 or '' ]]</para>
<para style="P10">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
<para style="P10">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
<para style="P10">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
</td>
</tr>
</blockTable>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11"><font face="Helvetica-Bold">Subject: </font>Invoice - [[ o.number ]]</para>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">Dear customer,</para>
<para style="P11">Here is the BVR to allow you to pay the invoice ' <font face="Times-Roman">[[ o.name ]]</font>', reference:<font face="Times-Roman"> [[ o.number ]].</font></para>
<para style="P11">Thanks,</para>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">[[ user.signature ]]</para>
<currentFrame name="Frame1"/>
<!--
Width: 2.3inch, 5.9inch
Height: 4*1/6 inch
-->
<illustration width="200mm" height="106mm">
<setFont name="Times-Roman" size="11"/>
<drawString x="6mm" y="79mm">[[ user.company_id.partner_id.name ]]</drawString>
<drawString x="6mm" y="74mm">[[ user.company_id.partner_id.address[0].street ]]</drawString>
<drawString x="6mm" y="69mm">[[ (user.company_id.partner_id.address[0].street2 or '')]]</drawString>
<drawString x="6mm" y="64mm">[[ user.company_id.partner_id.address[0].zip ]] [[ user.company_id.partner_id.address[0].city ]]</drawString>
<drawString x="62mm" y="79mm">[[ user.company_id.partner_id.name ]]</drawString>
<drawString x="62mm" y="74mm">[[ user.company_id.partner_id.address[0].street ]]</drawString>
<drawString x="62mm" y="69mm">[[ (user.company_id.partner_id.address[0].street2 or '')]]</drawString>
<drawString x="62mm" y="64mm">[[ user.company_id.partner_id.address[0].zip ]] [[ user.company_id.partner_id.address[0].city ]]</drawString>
<setFont name="ocrb" size="12"/>
<drawString x="126mm" y="67.5mm">[[ mod10r(o.number).rjust(27,'0') ]]</drawString>
<drawRightString x="39mm" y="50mm">[[ ('%.2f' % o.amount_total)[:-3] ]]</drawRightString>
<drawRightString x="100mm" y="50mm">[[ ('%.2f' % o.amount_total)[:-3] ]]</drawRightString>
<drawCentredString x="51mm" y="50mm">[[ ('%.2f' % o.amount_total)[-2:] ]]</drawCentredString>
<drawCentredString x="111mm" y="50mm">[[ ('%.2f' % o.amount_total)[-2:] ]]</drawCentredString>
<!--
Exact value: y=17.6mm
-->
<drawString x="66.72mm" y="16.20mm">01[[mod10r('%.2f' % o.amount_total).rjust(11,'0')]]&gt;[[ mod10r(o.number).rjust(27,'0')]]+ [[user.company_id.bvr_number.split('-')[0]+(user.company_id.bvr_number.split('-')[1]).rjust(6,'0')+user.company_id.bvr_number.split('-')[2] ]]</drawString>
</illustration>
<!--
<blockTable colWidths="144.0,151.0,243.0" rowheights="3cm,1cm,1cm,1cm,3cm,1cm" style="Table1">
<tr>
<td>
<para style="PBVR"></para>
<para style="PBVR"></para>
<para style="PBVR"></para>
<para style="PBVR"></para>
</td>
<td>
<para style="PBVR">[[ user.company_id.partner_id.name ]]</para>
<para style="PBVR">[[ user.company_id.partner_id.address[0].street ]]</para>
<para style="PBVR">[[ user.company_id.partner_id.address[0].street2 or '' ]]</para>
<para style="PBVR">[[ user.company_id.partner_id.address[0].zip ]] [[ user.company_id.partner_id.address[0].city ]]</para>
</td>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
<para style="PBVR">
<font color="white"> </font>
</para>
<para style="PBVR"></para>
</td>
</tr>
<tr>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="PBVR">[[ ('%.2f' % o.amount_total)[:-3] +' . '+ ('%.2f' % o.amount_total)[-2:] ]]</para>
</td>
<td>
<para style="PBVR">[[ ('%.2f' % o.amount_total)[:-3] +' . '+ ('%.2f' % o.amount_total)[-2:] ]]</para>
</td>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<para style="PBVR">
<font color="white"> </font>
</para>
</td>
<td>
</td>
</tr>
</blockTable>
-->
<frameEnd/>
</story>
</document>