diff --git a/addons/l10n_ch/__init__.py b/addons/l10n_ch/__init__.py index 82fb2cf7bcc..e8c8ae47d34 100644 --- a/addons/l10n_ch/__init__.py +++ b/addons/l10n_ch/__init__.py @@ -28,6 +28,5 @@ import wizard import payment import report import bank -import account_move_line # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/__openerp__.py b/addons/l10n_ch/__openerp__.py index 7beb51e0a81..60b91a06811 100644 --- a/addons/l10n_ch/__openerp__.py +++ b/addons/l10n_ch/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## { - "name" : "Switzerland localization with 2011 taxes Beta 1", + "name" : "Switzerland - localization with 2011 taxes", "description" : """ Swiss localisation : - DTA generation for a lot of payment types diff --git a/addons/l10n_ch/account_wizard.py b/addons/l10n_ch/account_wizard.py index b2e1ab00924..08c969dd654 100644 --- a/addons/l10n_ch/account_wizard.py +++ b/addons/l10n_ch/account_wizard.py @@ -21,6 +21,7 @@ import tools from osv import osv import addons +import os class WizardMultiChartsAccounts(osv.osv_memory): @@ -35,7 +36,7 @@ class WizardMultiChartsAccounts(osv.osv_memory): def execute(self, cr, uid, ids, context=None): """Override of code in order to be able to link journal with account in XML""" 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) return res diff --git a/addons/l10n_ch/company.py b/addons/l10n_ch/company.py index da8f7b53cc6..20f6b6168ec 100644 --- a/addons/l10n_ch/company.py +++ b/addons/l10n_ch/company.py @@ -27,13 +27,12 @@ class res_company(osv.osv): _inherit = "res.company" _columns = { - ### horiz. delta in mm 1.2 will print the bvz 1.2mm lefter 'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)', - help='horiz. delta in mm 1.2 will print the bvz 1.2mm lefter'), - ### vert. 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'), + 'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)', - help='vert. delta in mm 1.2 will print the bvz 1.2mm lefter'), - ### print bvr background image for standard paper or e-mail + help='vert. delta in mm 1.2 will print the bvr 1.2mm lower, negative value is possible'), + 'bvr_background': fields.boolean('Insert BVR background ?'), 'bvr_only': fields.boolean('Separated BVR only ?', diff --git a/addons/l10n_ch/demo/demo.xml b/addons/l10n_ch/demo/demo.xml index 7782669d995..6b3f4a2fdc4 100644 --- a/addons/l10n_ch/demo/demo.xml +++ b/addons/l10n_ch/demo/demo.xml @@ -1,5 +1,23 @@ + + + Main Partner Bank + 234567 + + + + OpenERP BVR Account + 11-1234-1 + + bvrbank + 11-1234-1 + + CH9100767000S00023455 + 0000000 + + + My bank ! @@ -7,6 +25,7 @@ Banque + +41 31 622 13 00 Marc Dufour diff --git a/addons/l10n_ch/demo/dta_demo.xml b/addons/l10n_ch/demo/dta_demo.xml index fbfc66f642d..d2968fcf40b 100644 --- a/addons/l10n_ch/demo/dta_demo.xml +++ b/addons/l10n_ch/demo/dta_demo.xml @@ -1,6 +1,7 @@ + Fortis s.a. 123456 @@ -11,7 +12,7 @@ 123456 bvrbank - 234567 + 234567 CH9100767000S00023455 diff --git a/addons/l10n_ch/dta_data.xml b/addons/l10n_ch/dta_data.xml index 7d25dcacdde..5ef689d551c 100644 --- a/addons/l10n_ch/dta_data.xml +++ b/addons/l10n_ch/dta_data.xml @@ -89,7 +89,7 @@ - bvr_number + post_number @@ -103,7 +103,7 @@ - bvr_number + post_number diff --git a/addons/l10n_ch/dta_view.xml b/addons/l10n_ch/dta_view.xml index ea2e300d10c..869eacae6f1 100644 --- a/addons/l10n_ch/dta_view.xml +++ b/addons/l10n_ch/dta_view.xml @@ -11,7 +11,6 @@ - @@ -27,7 +26,6 @@ - diff --git a/addons/l10n_ch/invoice.py b/addons/l10n_ch/invoice.py index aa59a742722..07c62d43d51 100644 --- a/addons/l10n_ch/invoice.py +++ b/addons/l10n_ch/invoice.py @@ -191,7 +191,6 @@ class account_tax_code(osv.osv): _name = 'account.tax.code' _inherit = "account.tax.code" _columns = { - ### The case code of the tax code 'code': fields.char('Case Code', size=512), } diff --git a/addons/l10n_ch/partner.py b/addons/l10n_ch/partner.py index cc2097640a0..35a4456b7fd 100644 --- a/addons/l10n_ch/partner.py +++ b/addons/l10n_ch/partner.py @@ -36,7 +36,6 @@ class res_partner_bank(osv.osv): _columns = { 'name': fields.char('Description', size=128, required=True), '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), 'dta_code': fields.char('DTA code', size=5), } diff --git a/addons/l10n_ch/report/bvr.mako b/addons/l10n_ch/report/bvr.mako index bebf943e11b..6ff8921a142 100644 --- a/addons/l10n_ch/report/bvr.mako +++ b/addons/l10n_ch/report/bvr.mako @@ -99,11 +99,11 @@ - + - +
${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 ''}
${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 ''}
${user.company_id.partner_id.name}
${user.company_id.partner_id.name}
${user.company_id.partner_id.address[0].street}
${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}
${inv.partner_bank_id.print_account and inv.partner_bank_id.bvr_number or ''}
${user.company_id.partner_id.address[0].street}
${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}
${inv.partner_bank_id.print_account and inv.partner_bank_id.bvr_number or ''}
${_space(_get_ref(inv))}
${user.company_id.partner_id.address[0].street}
${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}
${inv.partner_bank_id.print_account and inv.partner_bank_id.post_number or ''}
${user.company_id.partner_id.address[0].street}
${user.company_id.partner_id.address[0].zip} ${user.company_id.partner_id.address[0].city}
${inv.partner_bank_id.print_account and inv.partner_bank_id.post_number or ''}
${_space(_get_ref(inv))}
${_space(('%.2f' % inv.amount_total)[:-3], 1)}${ _space(('%.2f' % inv.amount_total)[-2:], 1)}
${_space(('%.2f' % inv.amount_total)[:-3], 1)}${ _space(('%.2f' % inv.amount_total)[-2:], 1)}
${mod10r('01'+str('%.2f' % inv.amount_total).replace('.','').rjust(10,'0'))}>${_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]}>
${mod10r('01'+str('%.2f' % inv.amount_total).replace('.','').rjust(10,'0'))}>${_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]}>
%endfor diff --git a/addons/l10n_ch/report/report_webkit_html.mako b/addons/l10n_ch/report/report_webkit_html.mako index 1cb2c7fe091..d15bfda2898 100644 --- a/addons/l10n_ch/report/report_webkit_html.mako +++ b/addons/l10n_ch/report/report_webkit_html.mako @@ -17,37 +17,37 @@ ${inv.address_invoice_id.country_id.name or ''|entity} %endif %if inv.address_invoice_id.phone : - ${_("Tel")}: ${inv.address_invoice_id.phone|entity} + ${_("Tel") |entity}: ${inv.address_invoice_id.phone|entity} %endif %if inv.address_invoice_id.fax : - ${_("Fax")}: ${inv.address_invoice_id.fax|entity} + ${_("Fax") |entity}: ${inv.address_invoice_id.fax|entity} %endif %if inv.address_invoice_id.email : - ${_("E-mail")}: ${inv.address_invoice_id.email|entity} + ${_("E-mail") |entity}: ${inv.address_invoice_id.email|entity} %endif %if inv.partner_id.vat : - ${_("VAT")}: ${inv.partner_id.vat|entity} + ${_("VAT") |entity}: ${inv.partner_id.vat|entity} %endif
%if inv.type == 'out_invoice' : - ${_("Invoice")} ${inv.number or ''|entity} + ${_("Invoice") |entity} ${inv.number or ''|entity} %elif inv.type == 'in_invoice' : - ${_("Supplier Invoice")} ${inv.number or ''|entity} + ${_("Supplier Invoice") |entity} ${inv.number or ''|entity} %elif inv.type == 'out_refund' : - ${_("Refund")} ${inv.number or ''|entity} + ${_("Refund") |entity} ${inv.number or ''|entity} %elif inv.type == 'in_refund' : - ${_("Supplier Refund")} ${inv.number or ''|entity} + ${_("Supplier Refund") |entity} ${inv.number or ''|entity} %endif

- +
${_("Document")}${_("Invoice Date")}${_("Partner Ref.")}
${_("Document") |entity}${_("Invoice Date") |entity}${_("Partner Ref.") |entity}
${inv.name}${formatLang(inv.date_invoice, date=True)|entity} 


- + %for line in inv.invoice_line : @@ -62,7 +62,7 @@
${_("Description")}${_("Taxes")}${_("QTY")}${_("Unit Price")}${_("Disc.(%)")}${_("Price")}
${_("Description") |entity}${_("Taxes") |entity}${_("QTY") |entity}${_("Unit Price") |entity}${_("Disc.(%)") |entity}${_("Price") |entity}
${line.name|entity}${ ', '.join([ tax.name or '' for tax in line.invoice_line_tax_id ])|entity}${line.quantity}${formatLang(line.price_unit)}${line.discount or 0.00}${formatLang(line.price_subtotal)}
- + %if inv.tax_line : %for t in inv.tax_line : @@ -74,7 +74,7 @@ %endif +
Tax${_("Base")}${_("Amount")}
Tax${_("Base") |entity}${_("Amount") |entity}
- ${_("Total")}${_("Total") |entity} ${ formatLang(inv.amount_tax) }
diff --git a/addons/l10n_ch/report/report_webkit_html.py b/addons/l10n_ch/report/report_webkit_html.py index ed7d4bbf60c..619a152405c 100644 --- a/addons/l10n_ch/report/report_webkit_html.py +++ b/addons/l10n_ch/report/report_webkit_html.py @@ -33,6 +33,7 @@ import addons import pooler from tools.config import config from mako.template import Template +from tools.translate import _ 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 }) - #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) : """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 def bvr_absolute_path(self) : """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 def headheight(self): @@ -76,7 +81,7 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): else : amount = str(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: return new else: @@ -98,7 +103,7 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): res = inv.partner_bank_id.bvr_adherent_num invoice_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')) 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] for invoice in invoice_obj.browse(cursor, self.uid, ids): if not invoice.partner_bank_id: - raise wizard.except_wizard('UserError', - 'No bank specified on invoice:\n' + \ + raise wizard.except_wizard(_('UserError'), + _('No bank specified on invoice:\n' + \ invoice_obj.name_get(cursor, self.uid, [invoice.id], - context={})[0][1]) - if not re.compile('[0-9][0-9]-[0-9]{3,6}-[0-9]').match( - invoice.partner_bank_id.bvr_number or ''): - raise wizard.except_wizard('UserError', - "Your bank BVR number should be of the form 0X-XXX-X! " + + context={})[0][1])) + if not self._compile_check_bvr.match( + invoice.partner_bank_id.post_number or ''): + raise wizard.except_wizard(_('UserError'), + _("Your bank BVR number should be of the form 0X-XXX-X! " + 'Please check your company ' + 'information for the invoice:\n' + invoice_obj.name_get(cursor, self.uid, [invoice.id], - context={})[0][1]) + context={})[0][1])) 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): raise wizard.except_wizard('UserError', '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 body_mako_tpl = Template(parse_template ,input_encoding='utf-8') #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') helper = report_helper.WebKitHelper(cursor, uid, report_xml.id, context) diff --git a/addons/l10n_ch/report/report_webkit_html_view.xml b/addons/l10n_ch/report/report_webkit_html_view.xml index 8c66b1038c8..c03db709162 100644 --- a/addons/l10n_ch/report/report_webkit_html_view.xml +++ b/addons/l10n_ch/report/report_webkit_html_view.xml @@ -2,8 +2,8 @@ - - + Portrait + A4