[MERGE] merged the branch of c2c that correct the l10n_ch module

bzr revid: qdp-launchpad@openerp.com-20110222150052-me7aiqpeba0jpptv
This commit is contained in:
Quentin (OpenERP) 2011-02-22 16:00:52 +01:00
commit 85ab0cc482
20 changed files with 179 additions and 183 deletions

View File

@ -28,6 +28,5 @@ import wizard
import payment import payment
import report import report
import bank import bank
import account_move_line
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -20,7 +20,7 @@
############################################################################## ##############################################################################
{ {
"name" : "Switzerland localization with 2011 taxes Beta 1", "name" : "Switzerland - localization with 2011 taxes",
"description" : """ "description" : """
Swiss localisation : Swiss localisation :
- DTA generation for a lot of payment types - DTA generation for a lot of payment types

View File

@ -1,87 +0,0 @@
# -*- coding: utf-8 -*-
#
# account_move_line.py
# l10n_ch
#
# Created by Nicolas Bessi based on Credric Krier contribution
#
# Copyright (c) 2009 CamptoCamp. 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.
#
##############################################################################
from osv import fields, osv
# -*- encoding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Donors: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
class AccountMoveLine(osv.osv):
""" Inherit account.move.line in order to add a custom link
between supplier invoice line and bank. The original link
was defined in account_payment between line """
_inherit = 'account.move.line'
def line2bank(self, cr, uid, ids, payment_type='manual', context=None):
"""add a link to account.move.line in order to link
supplier invoice line and bank. The original link
was defined in account_payment"""
payment_mode_obj = self.pool.get('payment.mode')
line2bank = {}
if not ids:
return {}
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
context=context)
for line in self.browse(cr, uid, ids, context=context):
if line.invoice and line.invoice.partner_bank_id:
line2bank[line.id] = line.invoice.partner_bank_id.id
elif line.partner_id:
for bank in line.partner_id.bank_ids:
if bank.state in bank_type:
line2bank[line.id] = bank.id
break
if line.id not in line2bank and line.partner_id.bank_ids:
line2bank[line.id] = line.partner_id.bank_ids[0].id
return line2bank
AccountMoveLine()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,6 +21,7 @@
import tools import tools
from osv import osv from osv import osv
import addons import addons
import os
class WizardMultiChartsAccounts(osv.osv_memory): class WizardMultiChartsAccounts(osv.osv_memory):
@ -35,7 +36,7 @@ class WizardMultiChartsAccounts(osv.osv_memory):
def execute(self, cr, uid, ids, context=None): def execute(self, cr, uid, ids, context=None):
"""Override of code in order to be able to link journal with account in XML""" """Override of code in order to be able to link journal with account in XML"""
res = super(WizardMultiChartsAccounts, self).execute(cr, uid, ids, context) res = super(WizardMultiChartsAccounts, self).execute(cr, uid, ids, context)
path = addons.get_module_resource('l10n_ch/sterchi_chart/account_journal_rel.xml') path = addons.get_module_resource(os.path.join('l10n_ch','sterchi_chart','account_journal_rel.xml'))
tools.convert_xml_import(cr, 'l10n_ch', path, idref=None, mode='init', noupdate=True, report=None) tools.convert_xml_import(cr, 'l10n_ch', path, idref=None, mode='init', noupdate=True, report=None)
return res return res

View File

@ -27,13 +27,12 @@ class res_company(osv.osv):
_inherit = "res.company" _inherit = "res.company"
_columns = { _columns = {
### horiz. delta in mm 1.2 will print the bvz 1.2mm lefter
'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)', 'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)',
help='horiz. delta in mm 1.2 will print the bvz 1.2mm lefter'), help='horiz. delta in mm 1.2 will print the bvr 1.2mm lefter, negative value is possible'),
### vert. delta in mm 1.2 will print the bvz 1.2mm lefter
'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)', 'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)',
help='vert. delta in mm 1.2 will print the bvz 1.2mm lefter'), help='vert. delta in mm 1.2 will print the bvr 1.2mm lower, negative value is possible'),
### print bvr background image for standard paper or e-mail
'bvr_background': fields.boolean('Insert BVR background ?'), 'bvr_background': fields.boolean('Insert BVR background ?'),
'bvr_only': fields.boolean('Separated BVR only ?', 'bvr_only': fields.boolean('Separated BVR only ?',

View File

@ -1,5 +1,23 @@
<openerp> <openerp>
<data noupdate="1"> <data noupdate="1">
<record model="res.bank" id="main_bank">
<field name="name">Main Partner Bank</field>
<field name="clearing">234567</field>
</record>
<record model="res.partner.bank" id="main_partner_bank">
<field name="name">OpenERP BVR Account</field>
<field name="acc_number">11-1234-1</field>
<field name="partner_id" ref="base.main_partner"/>
<field name="state">bvrbank</field>
<field name="post_number">11-1234-1</field>
<field name="bank" ref="main_bank"/>
<field name="iban">CH9100767000S00023455</field>
<field name="bvr_adherent_num">0000000</field>
</record>
<record id="bank" model="res.partner"> <record id="bank" model="res.partner">
<field name="comment">My bank !</field> <field name="comment">My bank !</field>
@ -7,6 +25,7 @@
<field name="name">Banque</field> <field name="name">Banque</field>
<field name="category_id" model="res.partner.category" search="[('name','=','Partenaire')]"/> <field name="category_id" model="res.partner.category" search="[('name','=','Partenaire')]"/>
</record> </record>
<record id="res_partner_address_bank1" model="res.partner.address"> <record id="res_partner_address_bank1" model="res.partner.address">
<field name="fax">+41 31 622 13 00</field> <field name="fax">+41 31 622 13 00</field>
<field name="name">Marc Dufour</field> <field name="name">Marc Dufour</field>

View File

@ -1,6 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openerp> <openerp>
<data> <data>
<!-- Transform into YAML for testing -->
<record model="res.bank" id="partner_bank"> <record model="res.bank" id="partner_bank">
<field name="name">Fortis s.a.</field> <field name="name">Fortis s.a.</field>
<field name="clearing">123456</field> <field name="clearing">123456</field>
@ -11,7 +12,7 @@
<field name="acc_number">123456</field> <field name="acc_number">123456</field>
<field name="partner_id" ref="base.res_partner_agrolait"/> <field name="partner_id" ref="base.res_partner_agrolait"/>
<field name="state">bvrbank</field> <field name="state">bvrbank</field>
<field name="bvr_number">234567</field> <field name="post_number">234567</field>
<field name="bank" ref="partner_bank"/> <field name="bank" ref="partner_bank"/>
<field name="iban">CH9100767000S00023455</field> <field name="iban">CH9100767000S00023455</field>
</record> </record>

View File

@ -89,7 +89,7 @@
<field name="readonly" eval="False"/> <field name="readonly" eval="False"/>
</record> </record>
<record model="res.partner.bank.type.field" id="bvr_num_field_bvrbank"> <record model="res.partner.bank.type.field" id="bvr_num_field_bvrbank">
<field name="name">bvr_number</field> <field name="name">post_number</field>
<field name="bank_type_id" ref="bvrbank"/> <field name="bank_type_id" ref="bvrbank"/>
<field name="required" eval="True"/> <field name="required" eval="True"/>
<field name="readonly" eval="False"/> <field name="readonly" eval="False"/>
@ -103,7 +103,7 @@
<field name="readonly" eval="False"/> <field name="readonly" eval="False"/>
</record> </record>
<record model="res.partner.bank.type.field" id="bvr_num_field_bvrpost"> <record model="res.partner.bank.type.field" id="bvr_num_field_bvrpost">
<field name="name">bvr_number</field> <field name="name">post_number</field>
<field name="bank_type_id" ref="bvrpost"/> <field name="bank_type_id" ref="bvrpost"/>
<field name="required" eval="True"/> <field name="required" eval="True"/>
<field name="readonly" eval="False"/> <field name="readonly" eval="False"/>

View File

@ -11,7 +11,6 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="acc_number" position="after"> <field name="acc_number" position="after">
<newline/> <newline/>
<field name="bvr_number"/>
<field name="bvr_adherent_num"/> <field name="bvr_adherent_num"/>
<field name="post_number"/> <field name="post_number"/>
<field name="dta_code"/> <field name="dta_code"/>
@ -27,7 +26,6 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="acc_number" position="after"> <field name="acc_number" position="after">
<newline/> <newline/>
<field name="bvr_number"/>
<field name="bvr_adherent_num"/> <field name="bvr_adherent_num"/>
<field name="post_number"/> <field name="post_number"/>
<field name="dta_code"/> <field name="dta_code"/>

View File

@ -191,7 +191,6 @@ class account_tax_code(osv.osv):
_name = 'account.tax.code' _name = 'account.tax.code'
_inherit = "account.tax.code" _inherit = "account.tax.code"
_columns = { _columns = {
### The case code of the tax code
'code': fields.char('Case Code', size=512), 'code': fields.char('Case Code', size=512),
} }

View File

@ -36,7 +36,6 @@ class res_partner_bank(osv.osv):
_columns = { _columns = {
'name': fields.char('Description', size=128, required=True), 'name': fields.char('Description', size=128, required=True),
'post_number': fields.char('Post number', size=64), 'post_number': fields.char('Post number', size=64),
'bvr_number': fields.char('BVR account number', size=11),
'bvr_adherent_num': fields.char('BVR adherent number', size=11), 'bvr_adherent_num': fields.char('BVR adherent number', size=11),
'dta_code': fields.char('DTA code', size=5), 'dta_code': fields.char('DTA code', size=5),
} }

View File

@ -99,11 +99,11 @@
<table name="bvrframe" id="${inv.id}" style="width:210mm;height:106mm;border-collapse:collapse;padding-left:3mm;font-family:Helvetica;font-size:8pt;border-width:0px" border="0" CELLPADDING="0" CELLSPACING="0"> <!--border-width:1px;border-style:solid;border-color:black;--> <table name="bvrframe" id="${inv.id}" style="width:210mm;height:106mm;border-collapse:collapse;padding-left:3mm;font-family:Helvetica;font-size:8pt;border-width:0px" border="0" CELLPADDING="0" CELLSPACING="0"> <!--border-width:1px;border-style:solid;border-color:black;-->
<tr style="height:16.933333mm;vertical-align:bottom;padding-bottom:3mm"><td style="width:60.14mm;padding-bottom:3mm"><div style="padding-left:3mm;">${inv.partner_bank_id and inv.partner_bank_id.print_bank and inv.partner_bank_id.bank and inv.partner_bank_id.bank.name or ''}</div></td><td style="width:60.96mm;padding-bottom:3mm"><div style="padding-left:3mm;">${inv.partner_bank_id and inv.partner_bank_id.print_bank and inv.partner_bank_id.bank and inv.partner_bank_id.bank.name or ''}</div></td><td style="width:88.9mm"></td></tr> <tr style="height:16.933333mm;vertical-align:bottom;padding-bottom:3mm"><td style="width:60.14mm;padding-bottom:3mm"><div style="padding-left:3mm;">${inv.partner_bank_id and inv.partner_bank_id.print_bank and inv.partner_bank_id.bank and inv.partner_bank_id.bank.name or ''}</div></td><td style="width:60.96mm;padding-bottom:3mm"><div style="padding-left:3mm;">${inv.partner_bank_id and inv.partner_bank_id.print_bank and inv.partner_bank_id.bank and inv.partner_bank_id.bank.name or ''}</div></td><td style="width:88.9mm"></td></tr>
<tr style="height:12.7mm;vertical-align:bottom;padding-bottom:3mm"><td style="width:60.14mm;padding-bottom:3mm"><div style="padding-left:3mm;"><b>${user.company_id.partner_id.name}</b></div></td><td style="width:60.96mm;padding-bottom:3mm"><div style="padding-left:3mm;"><b>${user.company_id.partner_id.name}</b></div></td><td style="width:88.9mm"></td></tr> <tr style="height:12.7mm;vertical-align:bottom;padding-bottom:3mm"><td style="width:60.14mm;padding-bottom:3mm"><div style="padding-left:3mm;"><b>${user.company_id.partner_id.name}</b></div></td><td style="width:60.96mm;padding-bottom:3mm"><div style="padding-left:3mm;"><b>${user.company_id.partner_id.name}</b></div></td><td style="width:88.9mm"></td></tr>
<tr style="height:16.933333mm;vertical-align:bottom;padding-bottom:0"><td><table style="padding-left:3mm;font-family:Helvetica;font-size:8pt" height="100%"><tr style="vertical-align:top;padding-bottom:0"><td>${user.company_id.partner_id.address[0].street}<br/> ${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}</td></tr><tr style="vertical-align:bottom;padding-bottom:0"><td><div style="padding-left:30.48mm;">${inv.partner_bank_id.print_account and inv.partner_bank_id.bvr_number or ''}</div></td></tr></table></td><td style="padding-left:3mm"><table style="padding-left:3mm;font-family:Helvetica;font-size:8pt" height="100%"><tr style="vertical-align:top;padding-bottom:0"><td>${user.company_id.partner_id.address[0].street}<br/>${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}</td></tr><tr style="vertical-align:bottom;padding-bottom:0"><td><div style="padding-left:30.48mm;">${inv.partner_bank_id.print_account and inv.partner_bank_id.bvr_number or ''}</div></td></tr></table></td><td style="text-align: right;padding-right:4mm;padding-bottom:8mm;font-size:11pt">${_space(_get_ref(inv))}</td></tr> <tr style="height:16.933333mm;vertical-align:bottom;padding-bottom:0"><td><table style="padding-left:3mm;font-family:Helvetica;font-size:8pt" height="100%"><tr style="vertical-align:top;padding-bottom:0"><td>${user.company_id.partner_id.address[0].street}<br/> ${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}</td></tr><tr style="vertical-align:bottom;padding-bottom:0"><td><div style="padding-left:30.48mm;">${inv.partner_bank_id.print_account and inv.partner_bank_id.post_number or ''}</div></td></tr></table></td><td style="padding-left:3mm"><table style="padding-left:3mm;font-family:Helvetica;font-size:8pt" height="100%"><tr style="vertical-align:top;padding-bottom:0"><td>${user.company_id.partner_id.address[0].street}<br/>${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}</td></tr><tr style="vertical-align:bottom;padding-bottom:0"><td><div style="padding-left:30.48mm;">${inv.partner_bank_id.print_account and inv.partner_bank_id.post_number or ''}</div></td></tr></table></td><td style="text-align: right;padding-right:4mm;padding-bottom:8mm;font-size:11pt">${_space(_get_ref(inv))}</td></tr>
<tr style="height:8.4666667mm;vertical-align:bottom;padding-bottom:0"> <td><table style="width:100%" CELLPADDING="0" CELLSPACING="0"><td style="width:4mm"></td><td style="width:40mm;text-align: right" >${_space(('%.2f' % inv.amount_total)[:-3], 1)}</td><td style="width:6mm"></td><td style="width:10mm;text-align: right">${ _space(('%.2f' % inv.amount_total)[-2:], 1)}</td><td style="width:3mm;text-align: right"></td></table></td><td><table style="width:100%" CELLPADDING="0" CELLSPACING="0"><td style="width:4mm"></td><td style="width:40mm;text-align: right" >${_space(('%.2f' % inv.amount_total)[:-3], 1)}</td><td style="width:6mm"></td><td style="width:10mm;text-align: right">${ _space(('%.2f' % inv.amount_total)[-2:], 1)}</td><td style="width:3mm;text-align: right"></td></table></td><td></td></tr> <tr style="height:8.4666667mm;vertical-align:bottom;padding-bottom:0"> <td><table style="width:100%" CELLPADDING="0" CELLSPACING="0"><td style="width:4mm"></td><td style="width:40mm;text-align: right" >${_space(('%.2f' % inv.amount_total)[:-3], 1)}</td><td style="width:6mm"></td><td style="width:10mm;text-align: right">${ _space(('%.2f' % inv.amount_total)[-2:], 1)}</td><td style="width:3mm;text-align: right"></td></table></td><td><table style="width:100%" CELLPADDING="0" CELLSPACING="0"><td style="width:4mm"></td><td style="width:40mm;text-align: right" >${_space(('%.2f' % inv.amount_total)[:-3], 1)}</td><td style="width:6mm"></td><td style="width:10mm;text-align: right">${ _space(('%.2f' % inv.amount_total)[-2:], 1)}</td><td style="width:3mm;text-align: right"></td></table></td><td></td></tr>
<tr style="height:21.166667mm"><td></td><td></td><td></td></tr> <tr style="height:21.166667mm"><td></td><td></td><td></td></tr>
<tr style="height:8.4666667mm"> <td></td><td></td><td></td></tr> <tr style="height:8.4666667mm"> <td></td><td></td><td></td></tr>
<tr style="height:21.166667mm;vertical-align:top"><td></td><td colspan="2" style="text-align:right;padding-right:0.3in;font-family:bvrocrb;font-size:12pt">${mod10r('01'+str('%.2f' % inv.amount_total).replace('.','').rjust(10,'0'))}&gt;${_get_ref(inv)}+${inv.partner_bank_id.bvr_number.split('-')[0]+(str(inv.partner_bank_id.bvr_number.split('-')[1])).rjust(6,'0')+inv.partner_bank_id.bvr_number.split('-')[2]}&gt;</td></tr> <tr style="height:21.166667mm;vertical-align:top"><td></td><td colspan="2" style="text-align:right;padding-right:0.3in;font-family:bvrocrb;font-size:12pt">${mod10r('01'+str('%.2f' % inv.amount_total).replace('.','').rjust(10,'0'))}&gt;${_get_ref(inv)}+${inv.partner_bank_id.post_number.split('-')[0]+(str(inv.partner_bank_id.post_number.split('-')[1])).rjust(6,'0')+inv.partner_bank_id.post_number.split('-')[2]}&gt;</td></tr>
</table> </table>
%endfor %endfor
</body> </body>

View File

@ -17,37 +17,37 @@
<tr><td>${inv.address_invoice_id.country_id.name or ''|entity} </td></tr> <tr><td>${inv.address_invoice_id.country_id.name or ''|entity} </td></tr>
%endif %endif
%if inv.address_invoice_id.phone : %if inv.address_invoice_id.phone :
<tr><td>${_("Tel")}: ${inv.address_invoice_id.phone|entity}</td></tr> <tr><td>${_("Tel") |entity}: ${inv.address_invoice_id.phone|entity}</td></tr>
%endif %endif
%if inv.address_invoice_id.fax : %if inv.address_invoice_id.fax :
<tr><td>${_("Fax")}: ${inv.address_invoice_id.fax|entity}</td></tr> <tr><td>${_("Fax") |entity}: ${inv.address_invoice_id.fax|entity}</td></tr>
%endif %endif
%if inv.address_invoice_id.email : %if inv.address_invoice_id.email :
<tr><td>${_("E-mail")}: ${inv.address_invoice_id.email|entity}</td></tr> <tr><td>${_("E-mail") |entity}: ${inv.address_invoice_id.email|entity}</td></tr>
%endif %endif
%if inv.partner_id.vat : %if inv.partner_id.vat :
<tr><td>${_("VAT")}: ${inv.partner_id.vat|entity}</td></tr> <tr><td>${_("VAT") |entity}: ${inv.partner_id.vat|entity}</td></tr>
%endif %endif
</table> </table>
<br /> <br />
%if inv.type == 'out_invoice' : %if inv.type == 'out_invoice' :
<span class="title">${_("Invoice")} ${inv.number or ''|entity}</span> <span class="title">${_("Invoice") |entity} ${inv.number or ''|entity}</span>
%elif inv.type == 'in_invoice' : %elif inv.type == 'in_invoice' :
<span class="title">${_("Supplier Invoice")} ${inv.number or ''|entity}</span> <span class="title">${_("Supplier Invoice") |entity} ${inv.number or ''|entity}</span>
%elif inv.type == 'out_refund' : %elif inv.type == 'out_refund' :
<span class="title">${_("Refund")} ${inv.number or ''|entity}</span> <span class="title">${_("Refund") |entity} ${inv.number or ''|entity}</span>
%elif inv.type == 'in_refund' : %elif inv.type == 'in_refund' :
<span class="title">${_("Supplier Refund")} ${inv.number or ''|entity}</span> <span class="title">${_("Supplier Refund") |entity} ${inv.number or ''|entity}</span>
%endif %endif
<br/> <br/>
<br/> <br/>
<table class="basic_table" width="90%"> <table class="basic_table" width="90%">
<tr><td>${_("Document")}</td><td>${_("Invoice Date")}</td><td>${_("Partner Ref.")}</td></tr> <tr><td>${_("Document") |entity}</td><td>${_("Invoice Date") |entity}</td><td>${_("Partner Ref.") |entity}</td></tr>
<tr><td>${inv.name}</td><td>${formatLang(inv.date_invoice, date=True)|entity}</td><td>&nbsp;</td></tr> <tr><td>${inv.name}</td><td>${formatLang(inv.date_invoice, date=True)|entity}</td><td>&nbsp;</td></tr>
</table> </table>
<h1><br /></h1> <h1><br /></h1>
<table class="list_table" width="90%"> <table class="list_table" width="90%">
<thead><tr><th>${_("Description")}</th><th class>${_("Taxes")}</th><th class>${_("QTY")}</th><th>${_("Unit Price")}</th><th >${_("Disc.(%)")}</th><th>${_("Price")}</th></tr></thead> <thead><tr><th>${_("Description") |entity}</th><th class>${_("Taxes") |entity}</th><th class>${_("QTY") |entity}</th><th>${_("Unit Price") |entity}</th><th >${_("Disc.(%)") |entity}</th><th>${_("Price") |entity}</th></tr></thead>
%for line in inv.invoice_line : %for line in inv.invoice_line :
<tbody> <tbody>
<tr><td>${line.name|entity}</td><td>${ ', '.join([ tax.name or '' for tax in line.invoice_line_tax_id ])|entity}</td><td>${line.quantity}</td><td style="text-align:right;">${formatLang(line.price_unit)}</td><td style="text-align:center;">${line.discount or 0.00}</td><td style="text-align:right;">${formatLang(line.price_subtotal)}</td></tr> <tr><td>${line.name|entity}</td><td>${ ', '.join([ tax.name or '' for tax in line.invoice_line_tax_id ])|entity}</td><td>${line.quantity}</td><td style="text-align:right;">${formatLang(line.price_unit)}</td><td style="text-align:center;">${line.discount or 0.00}</td><td style="text-align:right;">${formatLang(line.price_subtotal)}</td></tr>
@ -62,7 +62,7 @@
</table> </table>
<table class="list_table" width="40%"> <table class="list_table" width="40%">
<tr><th>Tax</th><th>${_("Base")}</th><th>${_("Amount")}</th></tr> <tr><th>Tax</th><th>${_("Base") |entity}</th><th>${_("Amount") |entity}</th></tr>
%if inv.tax_line : %if inv.tax_line :
%for t in inv.tax_line : %for t in inv.tax_line :
<tr> <tr>
@ -74,7 +74,7 @@
%endif %endif
<tr> <tr>
<td style="border-style:none"/> <td style="border-style:none"/>
<td style="border-top:2px solid"><b>${_("Total")}</b></td> <td style="border-top:2px solid"><b>${_("Total") |entity}</b></td>
<td style="border-top:2px solid">${ formatLang(inv.amount_tax) }</td> <td style="border-top:2px solid">${ formatLang(inv.amount_tax) }</td>
</tr> </tr>
</table> </table>

View File

@ -33,6 +33,7 @@ import addons
import pooler import pooler
from tools.config import config from tools.config import config
from mako.template import Template from mako.template import Template
from tools.translate import _
class l10n_ch_report_webkit_html(report_sxw.rml_parse): class l10n_ch_report_webkit_html(report_sxw.rml_parse):
@ -53,15 +54,19 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse):
'headheight': self.headheight 'headheight': self.headheight
}) })
#will be fixed in 5.0.10 _compile_get_ref = re.compile('[^0-9]')
_compile_comma_me = re.compile("^(-?\d+)(\d{3})")
_compile_check_bvr = re.compile('[0-9][0-9]-[0-9]{3,6}-[0-9]')
_compile_check_bvr_add_num = re.compile('[0-9]*$')
def police_absolute_path(self, inner_path) : def police_absolute_path(self, inner_path) :
"""Will get the ocrb police absolute path""" """Will get the ocrb police absolute path"""
path = addons.get_module_resource('l10n_ch/report/'+inner_path) path = addons.get_module_resource(os.path.join('l10n_ch','report',inner_path))
return path return path
def bvr_absolute_path(self) : def bvr_absolute_path(self) :
"""Will get the ocrb police absolute path""" """Will get the ocrb police absolute path"""
path = addons.get_module_resource('l10n_ch/report/bvr1.jpg') path = addons.get_module_resource(os.path.join('l10n_ch','report','bvr1.jpg'))
return path return path
def headheight(self): def headheight(self):
@ -76,7 +81,7 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse):
else : else :
amount = str(amount) amount = str(amount)
orig = amount orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) new = self._compile_comma_me.sub("\g<1>'\g<2>", amount)
if orig == new: if orig == new:
return new return new
else: else:
@ -98,7 +103,7 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse):
res = inv.partner_bank_id.bvr_adherent_num res = inv.partner_bank_id.bvr_adherent_num
invoice_number = '' invoice_number = ''
if inv.number: if inv.number:
invoice_number = re.sub('[^0-9]', '', inv.number) invoice_number = self._compile_get_ref.sub('', inv.number)
return mod10r(res + invoice_number.rjust(26-len(res), '0')) return mod10r(res + invoice_number.rjust(26-len(res), '0'))
def _check(self, invoices): def _check(self, invoices):
@ -109,20 +114,20 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse):
ids = [x.id for x in invoices] ids = [x.id for x in invoices]
for invoice in invoice_obj.browse(cursor, self.uid, ids): for invoice in invoice_obj.browse(cursor, self.uid, ids):
if not invoice.partner_bank_id: if not invoice.partner_bank_id:
raise wizard.except_wizard('UserError', raise wizard.except_wizard(_('UserError'),
'No bank specified on invoice:\n' + \ _('No bank specified on invoice:\n' + \
invoice_obj.name_get(cursor, self.uid, [invoice.id], invoice_obj.name_get(cursor, self.uid, [invoice.id],
context={})[0][1]) context={})[0][1]))
if not re.compile('[0-9][0-9]-[0-9]{3,6}-[0-9]').match( if not self._compile_check_bvr.match(
invoice.partner_bank_id.bvr_number or ''): invoice.partner_bank_id.post_number or ''):
raise wizard.except_wizard('UserError', raise wizard.except_wizard(_('UserError'),
"Your bank BVR number should be of the form 0X-XXX-X! " + _("Your bank BVR number should be of the form 0X-XXX-X! " +
'Please check your company ' + 'Please check your company ' +
'information for the invoice:\n' + 'information for the invoice:\n' +
invoice_obj.name_get(cursor, self.uid, [invoice.id], invoice_obj.name_get(cursor, self.uid, [invoice.id],
context={})[0][1]) context={})[0][1]))
if invoice.partner_bank_id.bvr_adherent_num \ if invoice.partner_bank_id.bvr_adherent_num \
and not re.compile('[0-9]*$').match( and not self._compile_check_bvr_add_num.match(
invoice.partner_bank_id.bvr_adherent_num): invoice.partner_bank_id.bvr_adherent_num):
raise wizard.except_wizard('UserError', raise wizard.except_wizard('UserError',
'Your bank BVR adherent number must contain exactly seven' + 'Your bank BVR adherent number must contain exactly seven' +
@ -194,7 +199,7 @@ class BVRWebKitParser(webkit_report.WebKitParser):
#default_filters=['unicode', 'entity'] can be used to set global filter #default_filters=['unicode', 'entity'] can be used to set global filter
body_mako_tpl = Template(parse_template ,input_encoding='utf-8') body_mako_tpl = Template(parse_template ,input_encoding='utf-8')
#BVR specific #BVR specific
bvr_path = addons.get_module_resource('l10n_ch/report/bvr.mako') bvr_path = addons.get_module_resource(os.path.join('l10n_ch','report','bvr.mako'))
body_bvr_tpl = Template(file(bvr_path).read(), input_encoding='utf-8') body_bvr_tpl = Template(file(bvr_path).read(), input_encoding='utf-8')
helper = report_helper.WebKitHelper(cursor, uid, report_xml.id, context) helper = report_helper.WebKitHelper(cursor, uid, report_xml.id, context)

View File

@ -2,8 +2,8 @@
<openerp> <openerp>
<data> <data>
<record id="ir_header_webkit_bvr_invoice0" model="ir.header_webkit"> <record id="ir_header_webkit_bvr_invoice0" model="ir.header_webkit">
<field eval="&quot;&quot;&quot;Portrait&quot;&quot;&quot;" name="orientation"/> <field name="orientation">Portrait</field>
<field eval="&quot;&quot;&quot;A4&quot;&quot;&quot;" name="format"/> <field name="format">A4</field>
<field name="html"><![CDATA[<html> <field name="html"><![CDATA[<html>
<head> <head>
<script> <script>
@ -144,7 +144,7 @@ width:74%;
.tax { .tax {
width:50%; width:50%;
}]]></field> }]]></field>
<field eval="&quot;&quot;&quot;BVR header&quot;&quot;&quot;" name="name"/> <field name="name">BVR header</field>
</record> </record>
<report auto="True" <report auto="True"

View File

@ -10,26 +10,31 @@
<field name="name">Bilan : Liquidites et titres</field> <field name="name">Bilan : Liquidites et titres</field>
<field name="code">cash</field> <field name="code">cash</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_adjusting_asset"> <record model="account.account.type" id="account_type_adjusting_asset">
<field name="name">Bilan : Actif de regularisation</field> <field name="name">Bilan : Actif de regularisation</field>
<field name="code">adjusting_asset</field> <field name="code">adjusting_asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_equity"> <record model="account.account.type" id="account_type_equity">
<field name="name">Bilan : Capitaux propres</field> <field name="name">Bilan : Capitaux propres</field>
<field name="code">equity</field> <field name="code">equity</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_income"> <record model="account.account.type" id="account_type_income">
<field name="name">PP : Chiffre d'affaires</field> <field name="name">PP : Chiffre d'affaires</field>
<field name="code">income</field> <field name="code">income</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">income</field>
</record> </record>
<record model="account.account.type" id="account_type_adj_liability"> <record model="account.account.type" id="account_type_adj_liability">
<field name="name">Bilan : Passifs de regularisation</field> <field name="name">Bilan : Passifs de regularisation</field>
<field name="code">adj_liability</field> <field name="code">adj_liability</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_closing"> <record model="account.account.type" id="account_type_closing">
<field name="name">Autre : Cloture</field> <field name="name">Autre : Cloture</field>
@ -40,103 +45,123 @@
<field name="name">PP : Amortissement</field> <field name="name">PP : Amortissement</field>
<field name="code">depreciation</field> <field name="code">depreciation</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">expense</field>
</record> </record>
<record model="account.account.type" id="account_type_financial_result"> <record model="account.account.type" id="account_type_financial_result">
<field name="name">PP : Resultat financier</field> <field name="name">PP : Resultat financier</field>
<field name="code">financial_result</field> <field name="code">financial_result</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">income</field>
</record> </record>
<record model="account.account.type" id="account_type_financial_asset"> <record model="account.account.type" id="account_type_financial_asset">
<field name="name">Bilan : Immobilisations financieres</field> <field name="name">Bilan : Immobilisations financieres</field>
<field name="code">financial_asset</field> <field name="code">financial_asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_building_asset"> <record model="account.account.type" id="account_type_building_asset">
<field name="name">Bilan : Immo corporelles immobilieres</field> <field name="name">Bilan : Immo corporelles immobilieres</field>
<field name="code">building_asset</field> <field name="code">building_asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_non_ope_asset"> <record model="account.account.type" id="account_type_non_ope_asset">
<field name="name">Bilan : Actifs hors exploitation</field> <field name="name">Bilan : Actifs hors exploitation</field>
<field name="code">non_ope_asset</field> <field name="code">non_ope_asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_other_ope_exp"> <record model="account.account.type" id="account_type_other_ope_exp">
<field name="name">PP : Autres charges d'exploitation</field> <field name="name">PP : Autres charges d'exploitation</field>
<field name="code">other_ope_expense</field> <field name="code">other_ope_expense</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">expense</field>
</record> </record>
<record model="account.account.type" id="account_type_non_ope_debts"> <record model="account.account.type" id="account_type_non_ope_debts">
<field name="name">Bilan : Dettes hors exploitation</field> <field name="name">Bilan : Dettes hors exploitation</field>
<field name="code">non_ope_debts</field> <field name="code">non_ope_debts</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_fixed_asset"> <record model="account.account.type" id="account_type_fixed_asset">
<field name="name">Bilan : Immo corporelles mobilieres</field> <field name="name">Bilan : Immo corporelles mobilieres</field>
<field name="code">fixed_asset</field> <field name="code">fixed_asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_intangible_asset"> <record model="account.account.type" id="account_type_intangible_asset">
<field name="name">Bilan : Immo incorporelles</field> <field name="name">Bilan : Immo incorporelles</field>
<field name="code">intangible_asset</field> <field name="code">intangible_asset</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_inventory"> <record model="account.account.type" id="account_type_inventory">
<field name="name">Bilan : Stocks</field> <field name="name">Bilan : Stocks</field>
<field name="code">inventory</field> <field name="code">inventory</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_lt_liability"> <record model="account.account.type" id="account_type_lt_liability">
<field name="name">Bilan : Dettes à LT</field> <field name="name">Bilan : Dettes à LT</field>
<field name="code">lt_liability</field> <field name="code">lt_liability</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_non_ope_result"> <record model="account.account.type" id="account_type_non_ope_result">
<field name="name">PP : Resultat activites annexes</field> <field name="name">PP : Resultat activites annexes</field>
<field name="code">non_oper_result</field> <field name="code">non_oper_result</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">income</field>
</record> </record>
<record model="account.account.type" id="account_type_other_payable"> <record model="account.account.type" id="account_type_other_payable">
<field name="name">Bilan : Autres creanciers à CT</field> <field name="name">Bilan : Autres creanciers à CT</field>
<field name="code">other_payable</field> <field name="code">other_payable</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_other_receivable"> <record model="account.account.type" id="account_type_other_receivable">
<field name="name">Bilan : Autres créances</field> <field name="name">Bilan : Autres créances</field>
<field name="code">other_receivable</field> <field name="code">other_receivable</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_personnal_exp"> <record model="account.account.type" id="account_type_personnal_exp">
<field name="name">PP : Charge de personnel</field> <field name="name">PP : Charge de personnel</field>
<field name="code">personnal_exp</field> <field name="code">personnal_exp</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">expense</field>
</record> </record>
<record model="account.account.type" id="account_type_prov_reserve"> <record model="account.account.type" id="account_type_prov_reserve">
<field name="name">Bilan : Provisions et reserves</field> <field name="name">Bilan : Provisions et reserves</field>
<field name="code">provision_reserve</field> <field name="code">provision_reserve</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_purchase"> <record model="account.account.type" id="account_type_purchase">
<field name="name">PP : Achat de marchandise</field> <field name="name">PP : Achat de marchandise</field>
<field name="code">purchase</field> <field name="code">purchase</field>
<field name="close_method">none</field> <field name="close_method">none</field>
<field name="report_type">expense</field>
</record> </record>
<record model="account.account.type" id="account_type_report_result"> <record model="account.account.type" id="account_type_report_result">
<field name="name">Bilan : Resultat reporte</field> <field name="name">Bilan : Resultat reporte</field>
<field name="code">report_result</field> <field name="code">report_result</field>
<field name="close_method">balance</field> <field name="close_method">balance</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_receivable"> <record model="account.account.type" id="account_type_receivable">
<field name="name">Bilan : Debiteurs</field> <field name="name">Bilan : Debiteurs</field>
<field name="code">receivable</field> <field name="code">receivable</field>
<field name="partner_account">True</field> <field name="partner_account">True</field>
<field name="close_method">unreconciled</field> <field name="close_method">unreconciled</field>
<field name="report_type">asset</field>
</record> </record>
<record model="account.account.type" id="account_type_payable"> <record model="account.account.type" id="account_type_payable">
<field name="name">Bilan : Fournisseurs</field> <field name="name">Bilan : Fournisseurs</field>
<field name="code">payable</field> <field name="code">payable</field>
<field name="partner_account">True</field> <field name="partner_account">True</field>
<field name="close_method">unreconciled</field> <field name="close_method">unreconciled</field>
<field name="report_type">liability</field>
</record> </record>
<record model="account.account.type" id="account_type_consolidation"> <record model="account.account.type" id="account_type_consolidation">
<field name="name">Autre : Consolidation</field> <field name="name">Autre : Consolidation</field>
@ -148,11 +173,6 @@
<field name="code">other</field> <field name="code">other</field>
<field name="close_method">none</field> <field name="close_method">none</field>
</record> </record>
<record model="account.account.type" id="account_type_closed">
<field name="name">Autre : Closed</field>
<field name="code">closed</field>
<field name="close_method">none</field>
</record>
<record id="ch_minimal_0" model="account.account.template"> <record id="ch_minimal_0" model="account.account.template">
<field name="name">Plan comptable</field> <field name="name">Plan comptable</field>
<field name="code">0</field> <field name="code">0</field>

View File

@ -1,26 +1,60 @@
-
I Partner data to Test BVR printing.
-
!record {model: res.partner.category, id: res_partner_category_bvr}:
name: Customers
- -
Creating a res.partner.bank record I create BVR DUMMY Customer.
-
!record {model: res.partner, id: res_partner_bvr}:
category_id:
- res_partner_category_bvr
name: BVR DUMMY
-
I create contact address for BVR DUMMY.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_bvr
street: Route de Belario
type: contact
-
I create invoice address for BVR DUMMY.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_bvr
street: Route de Belario
type: invoice
-
I create delivery address for BVR DUMMY.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_bvr
street: Route de Belario
type: delivery
- -
!record {model: res.partner.bank, id: res_partner_bank_account0}: In order to test the PDF BVR webkit reports defined on an invoice, we will create a Invoice Record
acc_number: 001-1001-1291-12323 -
bank: base.res_bank_1 !record {model: account.invoice, id: l10n_ch_invoice}:
bvr_number: 01-101-12 currency_id: base.CHF
name: Asustek Main Account company_id: base.main_company
partner_id: base.res_partner_asus address_invoice_id: res_partner_address_2
sequence: 0.0 partner_id: res_partner_bvr
state: bvbank state: draft
type: out_invoice
account_id: account.a_recv
name: BVR test invoice
address_contact_id: res_partner_address_1
- -
In order to test the BVR report, I will assign a bank to the invoice In order to test the BVR report, I will assign a bank to the invoice
- -
!record {model: account.invoice, id: test_invoice_2}: !record {model: account.invoice, id: l10n_ch_invoice}:
partner_bank_id: res_partner_bank_account0 partner_bank_id: main_partner_bank
address_invoice_id: base.res_partner_address_tang
partner_id: base.res_partner_asus
account_id: account.a_recv
company_id: base.main_company
- -
In order to test the PDF reports defined on a l10n_ch, we will print BVR Report In order to test the PDF reports defined on a l10n_ch, we will print BVR Report
- -
!python {model: account.invoice}: | !python {model: account.invoice}: |
from tools.test_reports import try_report from tools.test_reports import try_report
try_report(cr, uid, 'report.invoice_web_bvr', [ref('test_invoice_2')]) company = self.pool.get('res.users').browse(cr, uid, uid).company_id
company.lib_path and try_report(cr, uid, 'report.invoice_web_bvr', [ref('l10n_ch_invoice')]) or 'Webkit lib not set'

View File

@ -31,16 +31,16 @@ def _reconstruct_invoice_ref(cursor, user, reference, context=None):
### ###
id_invoice = False id_invoice = False
# On fait d'abord une recherche sur toutes les factures # On fait d'abord une recherche sur toutes les factures
# we now searhc for company # we now search for an invoice
user_obj = pooler.get_pool(cursor.dbname).get('res.users') user_obj = pooler.get_pool(cursor.dbname).get('res.users')
user_current=user_obj.browse(cursor, user, user) user_current=user_obj.browse(cursor, user, user)
## ##
cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = %s" ,(user_current.company_id.id,)) cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = %s" ,(user_current.company_id.id,))
result_invoice = cursor.fetchall() result_invoice = cursor.fetchall()
REF = re.compile('[^0-9]')
for inv_id,inv_name in result_invoice: for inv_id,inv_name in result_invoice:
inv_name = re.sub('[^0-9]', '0', str(inv_name)) inv_name = REF.sub('0', str(inv_name))
if inv_name == reference: if inv_name == reference:
id_invoice = inv_id id_invoice = inv_id
break break
@ -67,6 +67,8 @@ def _import(self, cursor, user, data, context=None):
property_obj = self.pool.get('ir.property') property_obj = self.pool.get('ir.property')
model_fields_obj = self.pool.get('ir.model.fields') model_fields_obj = self.pool.get('ir.model.fields')
attachment_obj = self.pool.get('ir.attachment') attachment_obj = self.pool.get('ir.attachment')
statement_obj = self.pool.get('account.bank.statement')
property_obj = self.pool.get('ir.property')
file = data['form']['file'] file = data['form']['file']
statement_id = data['id'] statement_id = data['id']
records = [] records = []
@ -124,14 +126,6 @@ def _import(self, cursor, user, data, context=None):
total_cost += record['cost'] total_cost += record['cost']
records.append(record) records.append(record)
# model_fields_ids = model_fields_obj.search(cursor, user, [
# ('name', 'in', ['property_account_receivable', 'property_account_payable']),
# ('model', '=', 'res.partner'),
# ], context=context)
# property_ids = property_obj.search(cursor, user, [
# ('fields_id', 'in', model_fields_ids),
# ('res_id', '=', False),
# ], context=context)
account_receivable = False account_receivable = False
account_payable = False account_payable = False
statement = statement_obj.browse(cursor, user, statement_id, context=context) statement = statement_obj.browse(cursor, user, statement_id, context=context)
@ -156,7 +150,6 @@ def _import(self, cursor, user, data, context=None):
], order='date desc', context=context) ], order='date desc', context=context)
if not line_ids: if not line_ids:
line_ids = _reconstruct_invoice_ref(cursor, user, reference, None) line_ids = _reconstruct_invoice_ref(cursor, user, reference, None)
partner_id = False partner_id = False
account_id = False account_id = False
for line in move_line_obj.browse(cursor, user, line_ids, context=context): for line in move_line_obj.browse(cursor, user, line_ids, context=context):
@ -174,8 +167,8 @@ def _import(self, cursor, user, data, context=None):
# line2reconcile = line.id # line2reconcile = line.id
account_id = line.account_id.id account_id = line.account_id.id
break break
result = voucher_obj.onchange_partner_id(cursor, user, [], partner_id=partner_id, journal_id=statement.journal_id.id, price=abs(record['amount']), currency_id= statement.currency.id, ttype='payment', context=context) result = voucher_obj.onchange_partner_id(cursor, user, [], partner_id, journal_id=statement.journal_id.id, price=abs(record['amount']), currency_id= statement.currency.id, ttype='receipt', date=statement.date ,context=context)
voucher_res = { 'type': 'payment' , voucher_res = { 'type': 'receipt' ,
'name': values['name'], 'name': values['name'],
'partner_id': partner_id, 'partner_id': partner_id,
@ -205,16 +198,32 @@ def _import(self, cursor, user, data, context=None):
account_id = account_receivable account_id = account_receivable
else: else:
account_id = account_payable account_id = account_payable
if not account_id : ##If line not linked to an invoice we create a line not linked to a voucher
if not account_id and not line_ids:
name = "property_account_receivable"
if record['amount'] < 0:
name = "property_account_payable"
prop = property_obj.search(
cursor,
user,
[
('name','=','property_account_receivable'),
('company_id','=',statement.company_id.id),
('res_id', '=', False)
]
)
if prop:
value = property_obj.read(cursor, user, prop[0], ['value_reference']).get('value_reference', False)
if value :
account_id = int(value.split(',')[1])
else :
raise osv.except_osv(_('Error'),
_('The properties account payable account receivable are not set'))
if not account_id and line_ids:
raise osv.except_osv(_('Error'), raise osv.except_osv(_('Error'),
_('The properties account payable account receivable')) _('The properties account payable account receivable are not set'))
values['account_id'] = account_id values['account_id'] = account_id
values['partner_id'] = partner_id values['partner_id'] = partner_id
# values['reconcile_id'] = statement_reconcile_obj.create(cursor, user, {
# 'line_ids': [(6, 0, [line2reconcile])],
# }, context=context)
statement_line_obj.create(cursor, user, values, context=context) statement_line_obj.create(cursor, user, values, context=context)
attachment_obj.create(cursor, user, { attachment_obj.create(cursor, user, {
'name': 'BVR', 'name': 'BVR',

View File

@ -410,7 +410,7 @@ def _create_dta(obj, cr, uid, data, context=None):
v['partner_post_number']= pline.bank_id.post_number \ v['partner_post_number']= pline.bank_id.post_number \
and pline.bank_id.post_number.replace('.', '').replace('-', '') \ and pline.bank_id.post_number.replace('.', '').replace('-', '') \
or False or False
v['partner_bvr'] = pline.bank_id.bvr_number or '' v['partner_bvr'] = pline.bank_id.post_number or ''
if v['partner_bvr']: if v['partner_bvr']:
v['partner_bvr'] = v['partner_bvr'].replace('-','') v['partner_bvr'] = v['partner_bvr'].replace('-','')
if len(v['partner_bvr']) < 9: if len(v['partner_bvr']) < 9:

View File

@ -123,17 +123,17 @@ class WebKitParser(report_sxw):
command.append("--footer-html '%s'"%(foot_file.name)) command.append("--footer-html '%s'"%(foot_file.name))
if webkit_header.margin_top : if webkit_header.margin_top :
command.append('--margin-top %s'%(webkit_header.margin_top)) command.append('--margin-top %s'%(str(webkit_header.margin_top).replace(',', '.')))
if webkit_header.margin_bottom : if webkit_header.margin_bottom :
command.append('--margin-bottom %s'%(webkit_header.margin_bottom)) command.append('--margin-bottom %s'%(str(webkit_header.margin_bottom).replace(',', '.')))
if webkit_header.margin_left : if webkit_header.margin_left :
command.append('--margin-left %s'%(webkit_header.margin_left)) command.append('--margin-left %s'%(str(webkit_header.margin_left).replace(',', '.')))
if webkit_header.margin_right : if webkit_header.margin_right :
command.append('--margin-right %s'%(webkit_header.margin_right)) command.append('--margin-right %s'%(str(webkit_header.margin_right).replace(',', '.')))
if webkit_header.orientation : if webkit_header.orientation :
command.append("--orientation '%s'"%(webkit_header.orientation)) command.append("--orientation '%s'"%(str(webkit_header.orientation).replace(',', '.')))
if webkit_header.format : if webkit_header.format :
command.append(" --page-size '%s'"%(webkit_header.format)) command.append(" --page-size '%s'"%(str(webkit_header.format).replace(',', '.')))
count = 0 count = 0
for html in html_list : for html in html_list :
html_file = file(os.path.join(tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w') html_file = file(os.path.join(tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w')