[FIX] better coding standard
authornicolas.bessi@camptocamp.com <>
Fri, 28 Jan 2011 08:48:01 +0000 (09:48 +0100)
committernicolas.bessi@camptocamp.com <>
Fri, 28 Jan 2011 08:48:01 +0000 (09:48 +0100)
bzr revid: nicolas.bessi@camptocamp.com-20110128084801-a2w9hvy2ipl1wzis

addons/l10n_ch/account_move_line.py
addons/l10n_ch/account_wizard.py
addons/l10n_ch/company.py
addons/l10n_ch/invoice.py
addons/l10n_ch/report/report_webkit_html.py
addons/l10n_ch/report/report_webkit_html_view.xml
addons/l10n_ch/wizard/create_dta.py

index da9aab7..9cf2ea2 100644 (file)
@@ -60,7 +60,7 @@ class AccountMoveLine(osv.osv):
 
     _inherit = 'account.move.line'
 
-    def line2bank(self, cr, uid, ids, payment_type='manual', context=None):
+    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"""
index b2e1ab0..08c969d 100644 (file)
@@ -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
         
index da8f7b5..20f6b61 100644 (file)
@@ -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 ?',
index aa59a74..07c62d4 100644 (file)
@@ -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),
     }
 
index 449bcb1..5e0a1f2 100644 (file)
@@ -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):
@@ -60,12 +61,12 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse):
 
     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):
@@ -113,18 +114,18 @@ 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])
+                                    context={})[0][1]))
             if not self._compile_check_bvr.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! " +
+                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 self._compile_check_bvr_add_num.match(
                             invoice.partner_bank_id.bvr_adherent_num):
@@ -198,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)
index 8c66b10..c03db70 100644 (file)
@@ -2,8 +2,8 @@
 <openerp>
     <data> 
         <record id="ir_header_webkit_bvr_invoice0" model="ir.header_webkit">
-            <field eval="&quot;&quot;&quot;Portrait&quot;&quot;&quot;" name="orientation"/>
-            <field eval="&quot;&quot;&quot;A4&quot;&quot;&quot;" name="format"/>
+            <field name="orientation">Portrait</field>
+            <field name="format">A4</field>
             <field name="html"><![CDATA[<html>
                     <head>
                         <script>
@@ -144,7 +144,7 @@ width:74%;
 .tax {
 width:50%;
 }]]></field>
-    <field eval="&quot;&quot;&quot;BVR header&quot;&quot;&quot;" name="name"/>
+    <field name="name">BVR header</field>
     </record>
         
     <report auto="True" 
index d014c6b..90054fd 100644 (file)
@@ -554,7 +554,7 @@ def _create_dta(obj, cr, uid, data, context=None):
         dta = dta + record_gt890(v).generate()
 
     dta_data = base64.encodestring(dta)
-    payment_obj.set_done(cr, uid, data['id'], context)
+    payment_obj.set_done(cr, uid, [data['id']], context)
     attachment_obj.create(cr, uid, {
         'name': 'DTA',
         'datas': dta_data,