← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/stock-logistic-barcode/7.0-fix_shortut_imports-afe into lp:stock-logistic-barcode

 

Alexandre Fayolle - camptocamp has proposed merging lp:~camptocamp/stock-logistic-barcode/7.0-fix_shortut_imports-afe into lp:stock-logistic-barcode.

Commit message:
cleanup (not thorough, but this is a good first stop IMO)

* use from . import xxx" instead of "import xxx"
* remove use of shortcut imports from the openerp package
* removed osv.osv usage, model instantiation
* some line wrapping, comma adding, trailing whitespace removing

Requested reviews:
  Stock and Logistic Core Editors (stock-logistic-core-editors)
Related bugs:
  Bug #1286023 in Stock And Logistic Bar Code: "some modules use shortcut imports "
  https://bugs.launchpad.net/stock-logistic-barcode/+bug/1286023

For more details, see:
https://code.launchpad.net/~camptocamp/stock-logistic-barcode/7.0-fix_shortut_imports-afe/+merge/208752

cleanup (not thorough, but this is a good first stop IMO)

* use from . import xxx" instead of "import xxx"
* remove use of shortcut imports from the openerp package
* removed osv.osv usage, model instantiation 
* some line wrapping, comma adding, trailing whitespace removing

Please don't be too picky in the review. Rather than just running pep8 over the package and reporting back the output, consider superseeding this MP with the warnings fixed. OTOH, if you find blatant errors caused by the refactoring please report them in the review. Thanks. 
-- 
https://code.launchpad.net/~camptocamp/stock-logistic-barcode/7.0-fix_shortut_imports-afe/+merge/208752
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~camptocamp/stock-logistic-barcode/7.0-fix_shortut_imports-afe into lp:stock-logistic-barcode.
=== modified file 'barcode_link/__init__.py'
--- barcode_link/__init__.py	2012-03-07 12:56:37 +0000
+++ barcode_link/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,6 +19,6 @@
 #
 #################################################################################
 
-import barcode_link
+from . import barcode_link
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'barcode_link/__openerp__.py'
--- barcode_link/__openerp__.py	2013-02-18 14:27:57 +0000
+++ barcode_link/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -20,25 +20,25 @@
 #################################################################################
 
 {
-    "name" : "Barcode link Module",
-    "version" : "1.0",
-    "author" : "Julius Network Solutions",
-    "description" : """
-    
+    "name": "Barcode link Module",
+    "version": "1.0",
+    "author": "Julius Network Solutions",
+    "description": """
+
 Presentation:
 
 The module Barcode_link adds a field Link in the barcode form.
 And link the barcode with a product.
 
 """,
-    "website" : "http://www.julius.fr";,
-    "depends" : [
+    "website": "http://www.julius.fr";,
+    "depends": [
         "tr_barcode",
     ],
-    "category" : "Generic Modules/Inventory Control",
-    "demo" : [],
-#    "images" : ['images/Barcode link.png'],
-    "data" : [
+    "category": "Generic Modules/Inventory Control",
+    "demo": [],
+#    "images": ['images/Barcode link.png'],
+    "data": [
         'barcode_link_view.xml',
     ],
     'test': [],

=== modified file 'base_gs1_barcode/__init__.py'
--- base_gs1_barcode/__init__.py	2013-01-03 13:03:37 +0000
+++ base_gs1_barcode/__init__.py	2014-02-28 09:26:54 +0000
@@ -18,5 +18,5 @@
 #
 ##############################################################################
 
-import gs1_barcode
-import res_users
+from . import gs1_barcode
+from . import res_users

=== modified file 'base_gs1_barcode/__openerp__.py'
--- base_gs1_barcode/__openerp__.py	2013-02-13 08:40:02 +0000
+++ base_gs1_barcode/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -19,9 +19,9 @@
 ##############################################################################
 
 {
-    'name' : 'Decoding API for GS1-128 (aka UCC/EAN-128) and GS1-Datamatrix',
-    'version' : '1.0',
-    'author' : u'Numérigraphe',
+    'name': 'Decoding API for GS1-128 (aka UCC/EAN-128) and GS1-Datamatrix',
+    'version': '1.0',
+    'author': u'Numérigraphe',
     'website': 'http://numerigraphe.com',
     'category': 'Generic Modules/Inventory Control',
     'description': """
@@ -51,20 +51,20 @@
 printable, and some applications may not record it. Yet other readers will \
 let you configure how to map <GS>, which may help improve compatibility.
 """,
-    'depends' : [
+    'depends': [
         'product',
     ],
-    'init_xml' : [],
-    'update_xml' : [
+    'init_xml': [],
+    'update_xml': [
         'gs1_barcode_view.xml',
         'res_users_view.xml',
         'data/gs1_barcode.csv',
         "security/ir.model.access.csv",
     ],
-    'test' : [
+    'test': [
         'test/gs1_barcode_test.yml'
     ],
     'active': False,
     'installable': False,
-    'license' : 'GPL-3',
+    'license': 'GPL-3',
 }

=== modified file 'base_gs1_barcode/gs1_barcode.py'
--- base_gs1_barcode/gs1_barcode.py	2013-01-03 13:03:37 +0000
+++ base_gs1_barcode/gs1_barcode.py	2014-02-28 09:26:54 +0000
@@ -24,15 +24,15 @@
 import re
 import time
 
-import netsvc
-from osv import osv, fields
-from tools.translate import _
+from openerp import netsvc
+from openerp.osv import orm, fields
+from openerp.tools.translate import _
 
-class invalid_gs1_barcode(osv.except_osv):
+class invalid_gs1_barcode(orm.except_orm):
     """Indicate an error occurred while decoding a GS1-128/GS1-Datamatrix code"""
     pass
 
-class gs1_barcode(osv.osv):
+class gs1_barcode(orm.Model):
     """GS1-128/GS1-Datamatrix barcode decoder API and configuration"""
     _name = "gs1_barcode"
     _description = __doc__
@@ -43,13 +43,20 @@
         'name': fields.char('Description', size=64, required=True, select=1,
                             translate=True),
         'length_fixed': fields.boolean('Fixed-length Data',
-                                       help='Indicates whether the length of the data for this Application Identifier is fixed or not.'),
+                                       help='Indicates whether the length of '
+                                            'the data for this Application '
+                                            'Identifier is fixed or not.'),
         'length_max': fields.integer('Maximum Data Length',
-                                     help='Maximum length of the data for this Application Identifier.', required=1),
+                                     help='Maximum length of the data for this '
+                                          'Application Identifier.', required=1),
         'length_min': fields.integer('Minimum Data Length',
-                                     help='Minimum length of the data for this Application Identifier.'),
+                                     help='Minimum length of the data for '
+                                          'this Application Identifier.'),
         'decimal': fields.boolean('Decimal Indicator',
-                                  help='Indicates whether a digit is expected before the data for this Application Identifier to indicate the position of the decimal point.'
+                                  help='Indicates whether a digit is expected '
+                                       'before the data for this Application '
+                                       'Identifier to indicate the position of '
+                                       'the decimal point.'
                                   ),
         'type': fields.selection([ ('string', 'Any character string'),
                                     ('numeric', 'Numeric value'),
@@ -57,10 +64,10 @@
                                     'Data Type', required=1),
     }
     _defaults = {
-        'length_fixed': lambda * a: True,
-        'length_max': lambda * a: 30,
-        'decimal': lambda * a: False,
-        'type': lambda * a: 'string',
+        'length_fixed': True,
+        'length_max': 30,
+        'decimal': False,
+        'type': 'string',
     }
     _sql_constraints = [
         ('ai_uniq', 'unique (ai)', 'The Application Identifier must be unique!'),
@@ -75,10 +82,10 @@
         separator) after each variable-length value. <GS> is usually
         expected to be sent as ASCII character 29 but that may be configured
         per user.
-        
+
         If the same Application Identifier is present several times in the
         string, only the its last value is returned.
-    
+
         @type  barcode_string: string
         @param barcode_string: GS1-128/GS1-Datamatrix string  to decode
         @return:               A dictionary of values with Application Identifiers as keys
@@ -91,11 +98,14 @@
 
         if not barcode_string.startswith(prefix):
             raise invalid_gs1_barcode(_('Error decoding barcode'),
-                                 _('Could not decode barcode : wrong prefix - the code should start with "%s"') % prefix)
+                                 _('Could not decode barcode : '
+                                   'wrong prefix - the code should '
+                                   'start with "%s"') % prefix)
 
         # We are going to use lots of regular expressions to decode the string,
         # and they all boil down to the following templates:
-        #  * regular expression template to match the AI code %s, to the group "ai". Must be formated with a string
+        #  * regular expression template to match the AI code %s, to the group
+        #    "ai". Must be formated with a string
         AI = r'(?P<ai>%s)'
         #  * regular expression template to match a fixed-length value of
         #    %d characters, to the group called "value".
@@ -147,21 +157,24 @@
                         groups = value_regexps[ai].match(barcode_string, position).groupdict()
                     except AttributeError:
                         raise invalid_gs1_barcode(_('Error decoding barcode'),
-                                             _('Could not decode barcode: incorrect value for Application Identifer "%s" at position %d') % (ai, position))
+                                             _('Could not decode barcode: '
+                                               'incorrect value for Application '
+                                               'Identifer "%s" at position %d') % (ai, position))
 
                     position += len(groups['value'])
                     results[ai] = groups['value'].replace(separator, '')
                     if types[ai] == 'numeric':
                         results[ai] = int(results[ai])
                         if 'decimal' in groups:
-                        	# Account for the decimal position
+                            # Account for the decimal position
                             results[ai] = results[ai] / (10 ** int(groups['decimal']))
                             position += len(groups['decimal'])
                     if types[ai] == 'date':
                         # Format the date
-                        # Some barcodes are edited with a day of 0 - change it to 1 to make it a valid date
+                        # Some barcodes are edited with a day of 0 - change it
+                        # to 1 to make it a valid date
                         if results[ai].endswith('00'):
-                            results[ai] = results[ai][:5]+'1'
+                            results[ai] = results[ai][:5] + '1'
                         results[ai] = time.strftime('%Y-%m-%d',
                                                     time.strptime(results[ai],
                                                                   '%y%m%d'))
@@ -171,8 +184,8 @@
             else:
                 # We couldn't find another valid AI in the rest of the code, give up
                 raise invalid_gs1_barcode(_('Error decoding barcode'),
-                                      _('Could not decode barcode: unknown Application Identifier at position %d') % position)
+                                      _('Could not decode barcode: '
+                                        'unknown Application Identifier '
+                                        'at position %d') % position)
 
         return results
-# XXX Instantiate to retain compatibility of this module with v6.0, remove later
-gs1_barcode()

=== modified file 'base_gs1_barcode/res_users.py'
--- base_gs1_barcode/res_users.py	2013-01-03 13:03:37 +0000
+++ base_gs1_barcode/res_users.py	2014-02-28 09:26:54 +0000
@@ -18,18 +18,27 @@
 #
 ##############################################################################
 
-from osv import osv, fields
+from openerp.osv import orm, fields
 
 # XXX This would probably be best in res_config_users
-class res_users(osv.osv):
+class res_users(orm.Model):
     """Add the bar code decoding configuration to the user profile"""
     _inherit = 'res.users'
 
     _columns = {
         # XXX those should be properties, not standard fields
-        'gs1_barcode_prefix': fields.char('Prefix', size=64,help="The prefix that the barcode scanner will send when GS1-128 or GS1-Datamatrix codes are scanned. No prefix is expected if this fields is left empty"),
-        'gs1_barcode_separator': fields.char('Group Separator', size=1,
-                                         help="The characters that the barcode scanner will send when a <GS> (Group Separator) is encountered in a GS1-128 or GS1-Datamatrix code. <GS> is usually found when the data is of variable length. The ASCII character 29 will be expected by default if this field is left empty."),
+        'gs1_barcode_prefix': fields.char(
+            'Prefix', size=64,
+            help="The prefix that the barcode scanner will send when GS1-128 "
+                 "or GS1-Datamatrix codes are scanned. No prefix is expected "
+                 "if this fields is left empty"
+            ),
+        'gs1_barcode_separator': fields.char(
+            'Group Separator', size=1,
+            help="The characters that the barcode scanner will send when a "
+                 "<GS> (Group Separator) is encountered in a GS1-128 or "
+                 "GS1-Datamatrix code. <GS> is usually found when the data "
+                 "is of variable length. The ASCII character 29 will be "
+                 "expected by default if this field is left empty."
+            ),
     }
-# XXX Instantiate to retain compatibility of this module with v6.0, remove later
-res_users()

=== modified file 'product_multi_ean/__openerp__.py'
--- product_multi_ean/__openerp__.py	2013-02-14 08:44:02 +0000
+++ product_multi_ean/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -19,14 +19,14 @@
 #
 ##############################################################################
 
-{'name' : 'Multiple EAN13 on products',
- 'version' : '1.1',
- 'author' : 'Camptocamp',
+{'name': 'Multiple EAN13 on products',
+ 'version': '1.1',
+ 'author': 'Camptocamp',
  'maintainer': 'Camptocamp',
  'category': 'Warehouse',
  'complexity': "normal",  # easy, normal, expert
- 'depends' : ['base', 'product'],
- 'description': """"
+ 'depends': ['base', 'product'],
+ 'description': """
 Allow Multiple EAN13 on products.
 A list of EAN13 is available for each product with a priority, so a
 main ean13 code is defined.
@@ -39,7 +39,7 @@
  'demo_xml': [],
  'tests': [],
  'installable': False,
- 'images' : ['/static/src/images/image'],
+ 'images': ['/static/src/images/image'],
  'auto_install': False,
  'license': 'AGPL-3',
  'application': True

=== modified file 'product_multi_ean/product_ean.py'
--- product_multi_ean/product_ean.py	2013-02-18 09:27:15 +0000
+++ product_multi_ean/product_ean.py	2014-02-28 09:26:54 +0000
@@ -19,23 +19,19 @@
 #
 ##############################################################################
 
-import openerp.addons.product.product as product
-from osv import osv, fields
-
-
-class ProductEan13(osv.osv):
-
+from openerp.osv import orm, fields
+from openerp.addons.product import product
+
+
+class ProductEan13(orm.Model):
     _name = 'product.ean13'
-
     _description = "List of EAN13 for a product."
-
     _columns = {'name': fields.char('EAN13', size=13),
                 'product_id':
                     fields.many2one('product.product',
                                     'Product',
                                     required=True),
                 'sequence': fields.integer('Sequence'), }
-
     _order = 'sequence'
 
     def _check_ean_key(self, cr, uid, ids):
@@ -62,33 +58,25 @@
                 vals['sequence'] = max([ean.sequence for ean in ean13s]) + 1
         return super(ProductEan13, self).create(cr, uid, vals, context=context)
 
-ProductEan13()
-
-
-class ProductProductEan(osv.osv):
+
+class ProductProductEan(orm.Model):
     """ Inherit the model product.product in order to create the m2o link
         This class definition has to be before the others below to ensure that
         the table is created before the migration
     """
-
     _inherit = 'product.product'
-
     _columns = {
         'ean13_ids': fields.one2many('product.ean13', 'product_id', 'EAN13'),
         }
 
-ProductProductEan()
-
-
-class ProductProductMigration(osv.osv):
+
+class ProductProductMigration(orm.Model):
     """ Inherit the model product.product in order to migrate the ean13
         column in the m2o table product_ean13
         This class definition has to be before the others below to ensure that
         the migration is done before the creation of the ean13 fields.function
     """
-
     _inherit = 'product.product'
-
     _columns = {
         'legacy_ean13': fields.char('Original EAN13', size=13, oldname='ean13'),
         }
@@ -104,14 +92,11 @@
                    " WHERE name = p.legacy_ean13 "
                    "       AND product_id = p.id)")
 
-ProductProductMigration()
-
-
-class ProductProduct(osv.osv):
-
+
+class ProductProduct(orm.Model):
     _inherit = 'product.product'
 
-    def _get_main_ean13(self, cr, uid, ids, field_name, arg, context):
+    def _get_main_ean13(self, cr, uid, ids, _field_name, _arg, context):
         values = {}
         for product in self.browse(cr, uid, ids, context=context):
             ean13 = False
@@ -128,7 +113,7 @@
             res.add(ean.product_id.id)
         return list(res)
 
-    def _write_ean(self, cr, uid, product_id, name, value, arg, context=None):
+    def _write_ean(self, cr, uid, product_id, _name, value, _arg, context=None):
         product = self.browse(cr, uid, product_id, context=context)
         if not value in [ean.name for ean in product.ean13_ids]:
             self.pool.get('product.ean13').create(
@@ -177,5 +162,3 @@
             args += [('ean13_ids', 'in', ean_ids)]
         return super(ProductProduct, self).search(
             cr, uid, args, offset, limit, order, context=context, count=count)
-
-ProductProduct()

=== modified file 'tr_barcode/__init__.py'
--- tr_barcode/__init__.py	2013-02-13 17:07:06 +0000
+++ tr_barcode/__init__.py	2014-02-28 09:26:54 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #/#############################################################################
-#    
+#
 #    Tech-Receptives Solutions Pvt. Ltd.
 #    Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
 #
@@ -15,11 +15,11 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 #/#############################################################################
 
-import tr_barcode
-import res_config
-import wizard
+from . import tr_barcode
+from . import res_config
+from . import wizard
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode/__openerp__.py'
--- tr_barcode/__openerp__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #/#############################################################################
-#    
+#
 #    Tech-Receptives Solutions Pvt. Ltd.
 #    Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
 #
@@ -15,7 +15,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 #/#############################################################################
 
@@ -28,7 +28,7 @@
 Presentation:
 
 This module adds the menu Barcode used to generate and configuration barcodes.
-    
+
     """,
     'author': 'Tech-Receptives Solutions Pvt. Ltd.',
     'website': 'http://www.techreceptives.com',

=== modified file 'tr_barcode/res_config.py'
--- tr_barcode/res_config.py	2013-02-18 09:27:15 +0000
+++ tr_barcode/res_config.py	2014-02-28 09:26:54 +0000
@@ -19,38 +19,41 @@
 #
 #################################################################################
 
-
-from openerp.osv import fields, osv, orm
 import copy
 
+from openerp.osv import fields, orm
+
 class ir_model(orm.Model):
     _inherit = 'ir.model'
-    
     _columns = {
-        'barcode_model': fields.boolean('Barcode linked', help='If checked, by default the barcode configuration will get this module in the list'),
-    }
-    
+        'barcode_model': fields.boolean('Barcode linked',
+                                        help='If checked, by default the barcode '
+                                             'configuration will get this module '
+                                             'in the list'),
+        }
     _defaults = {
         'barcode_model': False,
-    }
+        }
+
 
 class tr_barcode_settings(orm.TransientModel):
     _name = 'tr.barcode.settings'
     _inherit = 'res.config.settings'
-    
+
     def _get_default_barcode_models(self, cr, uid, context=None):
-        return self.pool.get('ir.model').search(cr, uid, [('barcode_model', '=', True)], context=context)
-    
+        return self.pool.get('ir.model').search(cr, uid,
+                                                [('barcode_model', '=', True)],
+                                                context=context)
+
     _columns = {
         'models_ids': fields.many2many('ir.model',
             'tr_barcode_settings_mode_rel',
             'tr_id', 'model_id', 'Models'),
-    }
-    
+        }
     _defaults = {
         'models_ids': _get_default_barcode_models,
-    }
-    
+        }
+
     def update_field(self, cr, uid, vals, context=None):
         ## Init ##
         if context is None:
@@ -65,16 +68,20 @@
         elif vals['models_ids'][0] and vals['models_ids'][0][2]:
             model_ids = vals['models_ids'][0][2]
         ### Unlink Previous Entries ###
-        unlink_ids = action_obj.search(cr,  uid, [('res_model' , '=', 'tr.barcode.wizard')])
+        unlink_ids = action_obj.search(cr,  uid,
+                                       [('res_model' , '=', 'tr.barcode.wizard')],
+                                       context=context)
         for unlink_id in unlink_ids:
             action_obj.unlink(cr, uid, unlink_id)
             un_val_ids = value_obj.search(cr, uid,[
                 ('value' , '=',"ir.actions.act_window," + str(unlink_id)),
                 ])
             value_obj.unlink(cr, uid, un_val_ids)
-            
         ### Create New Fields ###
-        read_datas = model_obj.read(cr, uid, model_ids, ['model','name'], context=context)
+        read_datas = model_obj.read(cr, uid,
+                                    model_ids,
+                                    ['model', 'name'],
+                                    context=context)
         for model in read_datas:
             act_id = action_obj.create(cr, uid, {
                  'name': "%s Barcode" % model['name'],
@@ -87,15 +94,15 @@
                  'view_mode':'form,tree',
                  'target': 'new',
             }, context=context)
-            value_obj.create(cr, uid, {
-                 'name': "%s Barcode" % model['name'],
-                 'model': model['model'],
-                 'key2': 'client_action_multi',
-                 'value': "ir.actions.act_window," + str(act_id),
-            }, context=context)
-            
+            value_obj.create(cr, uid,
+                             {'name': "%s Barcode" % model['name'],
+                              'model': model['model'],
+                              'key2': 'client_action_multi',
+                              'value': "ir.actions.act_window," + str(act_id),
+                              },
+                             context=context)
         return True
-    
+
     def create(self, cr, uid, vals, context=None):
         """ create method """
         vals2 = copy.deepcopy(vals)
@@ -103,18 +110,17 @@
         ## Fields Process ##
         self.update_field(cr, uid, vals, context=context)
         return result
-    
+
     def install(self, cr, uid, ids, context=None):
-#       Initialisation of the configuration
+        # Initialisation of the configuration
         if context is None:
             context = {}
-        """ install method """
+        # install method 
         for vals in self.read(cr, uid, ids, context=context):
             result = self.update_field(cr, uid, vals, context=context)
-            
         return {
             'type': 'ir.actions.client',
             'tag': 'reload',
-        }
+            }
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode/tr_barcode.py'
--- tr_barcode/tr_barcode.py	2013-02-18 09:27:15 +0000
+++ tr_barcode/tr_barcode.py	2014-02-28 09:26:54 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #/#############################################################################
-#    
+#
 #    Tech-Receptives Solutions Pvt. Ltd.
 #    Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
 #
@@ -15,39 +15,43 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 #/#############################################################################
 
 import os
-from openerp.osv import fields, osv, orm
 import base64
+
 from PIL import Image
+
+from openerp.osv import fields, osv, orm
 try:
     from reportlab.graphics.barcode import createBarcodeDrawing, \
             getCodes
 except :
     print "ERROR IMPORTING REPORT LAB"
 
+
 def _get_code(self, cr, uid, context=None):
     """get availble code """
     codes = [(r, r) for r in getCodes()]
     codes.append(('qrcode','QR'))
     return codes
 
+
 class tr_barcode(orm.Model):
     """ Barcode Class """
     _name = "tr.barcode"
     _description = "Barcode"
     _rec_name = 'code'
-    
+
     def _get_barcode2(self, cr, uid, ids, name, attr, context=None):
         res = {}
         barcodes = self.browse(cr, uid, ids, context=context)
         for barcode in barcodes:
             res[barcode.id] = barcode.code
         return res
-    
+
     _columns = {
         'code': fields.char('Barcode',size=256),
         'code2': fields.function(_get_barcode2, method=True, string='Barcode2', type='char', size=256, store=True),
@@ -62,6 +66,7 @@
                 help="To genrate Barcode In Human readable form"),
         'barcode_type':fields.selection(_get_code, 'Type'),
     }
+
     def get_image(self, value, width, hight, hr, code='QR'):
         """ genrating image for barcode """
         options = {}
@@ -85,7 +90,7 @@
             qrCode = QR(data=value)
             qrCode.encode()
             return base64.encodestring(open(qrCode.filename,"rb").read())
-    
+
     def generate_image(self, cr, uid, ids, context=None):
         "button function for genrating image """
         if not context:

=== modified file 'tr_barcode/tr_barcode_installer.py'
--- tr_barcode/tr_barcode_installer.py	2013-02-18 09:27:15 +0000
+++ tr_barcode/tr_barcode_installer.py	2014-02-28 09:26:54 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #/#############################################################################
-#    
+#
 #    Tech-Receptives Solutions Pvt. Ltd.
 #    Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
 #
@@ -15,23 +15,23 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 #/#############################################################################
 
-from osv import fields, osv, orm
+from openerp.osv import fields, orm
 import copy
 
 class tr_barcode_installer(orm.TransientModel):
     """ config wizard for barcode module """
     _name = 'tr_barcode.installer'
     _inherit = 'res.config.installer'
-
     _columns = {
         'models_ids': fields.many2many('ir.model',
                         'tr_barcode_installer_mode_rel',
                         'tr_id', 'model_id', 'Models'),
     }
+
     def create(self, cr, uid, vals, context=None):
         """ create method """
         vals2 = copy.deepcopy(vals)

=== modified file 'tr_barcode/wizard/__init__.py'
--- tr_barcode/wizard/__init__.py	2012-11-26 15:04:36 +0000
+++ tr_barcode/wizard/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,5 +19,5 @@
 #
 ##############################################################################
 
-import tr_barcode_wizard
+from . import tr_barcode_wizard
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode/wizard/tr_barcode_wizard.py'
--- tr_barcode/wizard/tr_barcode_wizard.py	2013-02-18 09:27:15 +0000
+++ tr_barcode/wizard/tr_barcode_wizard.py	2014-02-28 09:26:54 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #/#############################################################################
-#    
+#
 #    Tech-Receptives Solutions Pvt. Ltd.
 #    Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
 #
@@ -15,22 +15,26 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 #/#############################################################################
+import logging
 
 from openerp.osv import  fields, osv, orm
 from openerp.tools.translate import _
+
+_logger = logging.getLogger(__name__)
 try:
-    from reportlab.graphics.barcode import createBarcodeDrawing, \
-            getCodes
-except :
-    print "ERROR IMPORTING REPORT LAB"
+    from reportlab.graphics.barcode import getCodes
+except:
+    _logger.warning('unable to import reportlab')
+
 
 def _get_code(self, cr, uid, context=None):
     """get availble code """
     return [(r, r) for r in getCodes()]
 
+
 class tr_barcode_wizard(orm.TransientModel):
     """ wizard for barcode """
     _name = "tr.barcode.wizard"
@@ -40,7 +44,9 @@
             context = {}
         if not context.get('active_model',False) or not context.get('active_id',False):
             return False
-        vals = self.pool.get(context['active_model']).browse(cr, uid, context['active_id'], context=context)
+        vals = self.pool.get(context['active_model']).browse(cr, uid,
+                                                             context['active_id'],
+                                                             context=context)
         return vals and vals.x_barcode_id and vals.x_barcode_id.code or False
 
     _columns = {
@@ -54,10 +60,10 @@
         'barcode_type':fields.selection(_get_code, 'Type'),
         'hr_form':fields.boolean("Human Readable",
                 help="To genrate Barcode In Human readable form"),
-    }
+        }
     _defaults = {
         'barcode': _get_val,
-    }
+        }
     def open_existing(self, cr, uid, ids, context=None):
         """ function will open existing report """
         if not context:
@@ -74,7 +80,7 @@
             'res_model': 'tr.barcode',
             'view_id': False,
             'type': 'ir.actions.act_window',
-        }
+            }
 
     def create_barcode_record(self, cr, uid, ids, context=None):
         """
@@ -84,7 +90,8 @@
         barcode_pool = self.pool.get('tr.barcode')
         for self_obj in self.browse(cr, uid, ids, context=context):
             if not self_obj.barcode:
-                raise osv.except_osv(_('Error'), _('Please specify code to generate Barcode !'))
+                raise osv.except_osv(_('Error'),
+                                     _('Please specify code to generate Barcode !'))
             if not self_obj.barcode_type:
                 raise osv.except_osv(_('Error'), _('Please Select Type !'))
             cr_id = barcode_pool.create(cr, uid, {
@@ -96,10 +103,9 @@
                 'res_model':context.get('src_model',False) or \
                             context['active_model'],
                 'res_id':context['active_id'],
-            })
+                })
             barcode_pool.generate_image(cr, uid, [cr_id], context=context)
-                        
-            return {    
+            return {
                 'res_id': cr_id,
                 'name': 'Barcode',
                 'view_type': 'form',
@@ -107,6 +113,6 @@
                 'res_model': 'tr.barcode',
                 'view_id': False,
                 'type': 'ir.actions.act_window',
-            } 
+                }
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_config/__init__.py'
--- tr_barcode_config/__init__.py	2012-08-14 12:25:26 +0000
+++ tr_barcode_config/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,6 +19,6 @@
 #
 #################################################################################
 
-import barcode_config
+from . import barcode_config
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_config/__openerp__.py'
--- tr_barcode_config/__openerp__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_config/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -20,15 +20,15 @@
 #################################################################################
 
 {
-    "name" : "Barcode configuration Module",
-    "version" : "1.1",
-    "author" : "Julius Network Solutions",
-    "description" : """
-
+    "name": "Barcode configuration Module",
+    "version": "1.1",
+    "author": "Julius Network Solutions",
+    "description": """
 Presentation:
 
 This module adds a configuration object and barcode osv to manage the barcode.
-You should define your object like this to manage automatically the creation / edition of your barcode:
+You should define your object like this to manage automatically the creation /
+edition of your barcode:
 
 from tr_barcode_config.barcode import barcode_osv
 
@@ -36,14 +36,14 @@
     _inherit = 'product.product'
 
 """,
-    "website" : "http://www.julius.fr";,
-    "depends" : [
+    "website": "http://www.julius.fr";,
+    "depends": [
         "tr_barcode",
         "tr_barcode_field",
     ],
-    "category" : "Warehouse Management",
-    "demo" : [],
-    "data" : [
+    "category": "Warehouse Management",
+    "demo": [],
+    "data": [
         'barcode_config_view.xml',
         "security/ir.model.access.csv",
     ],

=== modified file 'tr_barcode_config/barcode/__init__.py'
--- tr_barcode_config/barcode/__init__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_config/barcode/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,6 +19,6 @@
 #
 #################################################################################
 
-import barcode_osv
+from . import barcode_osv
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_config/barcode/barcode_osv.py'
--- tr_barcode_config/barcode/barcode_osv.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_config/barcode/barcode_osv.py	2014-02-28 09:26:54 +0000
@@ -20,9 +20,10 @@
 #################################################################################
 
 from openerp.osv import orm, fields
-import pooler
+from openerp import pooler
 from openerp import SUPERUSER_ID
-    
+
+
 def write_barcode(cr, uid, ids, vals, model, context=None):
     pool = pooler.get_pool(cr.dbname)
     for id in ids:
@@ -60,6 +61,7 @@
             barcode_obj.generate_image(cr, uid, [id], context=context)
     return True
 
+
 def create_barcode(cr, uid, id, vals, model, context=None):
     pool = pooler.get_pool(cr.dbname)
     config_obj = pool.get('tr.barcode.config')
@@ -92,9 +94,10 @@
         write_barcode(cr, uid, [barcode_id], vals, model, context=context)
     return barcode_id
 
+
 class barcode_osv(orm.Model):
     _register = False
-    
+
     def __init__(self, pool, cr):
         installer_obj = pool.get('tr.barcode.settings')
         model_obj = pool.get('ir.model')
@@ -102,23 +105,25 @@
         model_ids = model_obj.search(cr, uid, [('model', '=', self._name)])
         installer_obj.create(cr, uid, {'models_ids': [(6,0,model_ids)]}, context=None)
         super(barcode_osv, self).__init__(pool, cr)
-    
+
     def create(self, cr, uid, vals, context=None):
         barcode_id = False
         res = super(orm.Model, self).create(cr, uid, vals, context=context)
-        
-        #### modification because the orm create method seems to go into the write method so there is 2 barcode created instead of one ####
+
+        #### modification because the orm create method seems to go into the
+        #### write method so there is 2 barcode created instead of one ####
         obj = self.browse(cr, uid, res, context=context)
         if not obj.x_barcode_id:
             barcode_id = create_barcode(cr, uid, res, vals, self._name, context=context)
         else:
             barcode_id = obj.x_barcode_id.id
-        #############################################################        
-                
+        #############################################################
+
         if barcode_id:
-            cr.execute(("UPDATE %s SET x_barcode_id = %s WHERE id = %s") %(self._table,barcode_id,res))
+            cr.execute(("UPDATE %s SET x_barcode_id = %s WHERE id = %s") % (self._table,barcode_id,
+                                                                            res))
         return res
-    
+
     def write(self, cr, uid, ids, vals, context=None):
         if context==None:
            context = {}
@@ -128,19 +133,33 @@
         for obj in self.browse(cr, uid, ids, context=context):
             context.update({'obj_id':obj.id})
             if not obj.x_barcode_id:
-                barcode_ids = barcode_obj.search(cr, uid, [
-                                            ('res_model', '=', self._name),
-                                            ('res_id', '=', obj.id)
-                                            ], limit=1, context=context)
+                barcode_ids = barcode_obj.search(cr, uid,
+                                                 [('res_model', '=', self._name),
+                                                  ('res_id', '=', obj.id)
+                                                  ],
+                                                 limit=1,
+                                                 context=context)
                 if barcode_ids:
-                    write_barcode(cr, uid, [barcode_ids[0]], vals, self._name, context=context)
+                    write_barcode(cr, uid,
+                                  [barcode_ids[0]],
+                                  vals,
+                                  self._name,
+                                  context=context)
                     vals['x_barcode_id'] = barcode_ids[0]
                 else:
-                    barcode_id = create_barcode(cr, uid, obj.id, vals, self._name, context=context)
+                    barcode_id = create_barcode(cr, uid,
+                                                obj.id,
+                                                vals,
+                                                self._name,
+                                                context=context)
                     if barcode_id:
                         vals['x_barcode_id'] = barcode_id
             else:
-                write_barcode(cr, uid, [obj.x_barcode_id.id], vals, self._name, context=context)
+                write_barcode(cr, uid,
+                              [obj.x_barcode_id.id],
+                              vals,
+                              self._name,
+                              context=context)
         return super(orm.Model, self).write(cr, uid, ids, vals, context=context)
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_config/barcode_config.py'
--- tr_barcode_config/barcode_config.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_config/barcode_config.py	2014-02-28 09:26:54 +0000
@@ -18,38 +18,43 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 #################################################################################
-
-from openerp.osv import fields, osv, orm
-
-from openerp.tools.translate import _
+import logging
+
+from openerp.osv import fields, orm
+
+_logger = logging.getLogger(__name__)
 try:
-    from reportlab.graphics.barcode import createBarcodeDrawing, \
-            getCodes
-except :
-    print "ERROR IMPORTING REPORT LAB"
+    from reportlab.graphics.barcode import getCodes
+except ImportError:
+    _logger.warning('unable to import reportlab')
+
 
 def _get_code(self, cr, uid, context=None):
     """get availble code """
     return [(r, r) for r in getCodes()]
 
+
 class tr_barcode_config(orm.Model):
-    
     _name = 'tr.barcode.config'
-    
     _columns = {
-        'res_model': fields.many2one('ir.model', 'Object', domain=[('barcode_model', '=', True)], required=True),
-        'field': fields.many2one('ir.model.fields', 'Field', domain=[('ttype', '=', 'char')], required=True),
+        'res_model': fields.many2one('ir.model', 'Object',
+                                     domain=[('barcode_model', '=', True)],
+                                     required=True),
+        'field': fields.many2one('ir.model.fields', 'Field',
+                                 domain=[('ttype', '=', 'char')],
+                                 required=True),
         'width': fields.integer("Width",
-                help="Leave Blank or 0(ZERO) for default size"),
+                     help="Leave Blank or 0(ZERO) for default size"),
         'height': fields.integer("Height",
-                help="Leave Blank or 0(ZERO) for default size"),
+                     help="Leave Blank or 0(ZERO) for default size"),
         'hr_form': fields.boolean("Human Readable",
-                help="To generate Barcode In Human readable form"),
+                     help="To generate Barcode In Human readable form"),
         'barcode_type': fields.selection(_get_code, 'Type', required=True),
-    }
-    
+        }
     _sql_constraints = [
-        ('res_model_uniq', 'unique(res_model)', 'You can have only one config by model !'),
-    ]
+        ('res_model_uniq',
+         'unique(res_model)',
+         'You can have only one config by model !'),
+        ]
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_field/__init__.py'
--- tr_barcode_field/__init__.py	2012-03-07 12:56:37 +0000
+++ tr_barcode_field/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,6 +19,6 @@
 #
 #################################################################################
 
-import barcode_field
+from . import barcode_field
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_field/__openerp__.py'
--- tr_barcode_field/__openerp__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_field/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -20,23 +20,23 @@
 #################################################################################
 
 {
-    "name" : "Barcode field Module",
-    "version" : "1.1",
-    "author" : "Julius Network Solutions",
-    "description" : """
+    "name": "Barcode field Module",
+    "version": "1.1",
+    "author": "Julius Network Solutions",
+    "description": """
 
 Presentation:
 
 This module adds a field to make a link between the product and the barcode.
 
 """,
-    "website" : "http://www.julius.fr";,
-    "depends" : [
+    "website": "http://www.julius.fr";,
+    "depends": [
         "tr_barcode",
     ],
-    "category" : "Warehouse Management",
-    "demo" : [],
-    "data" : [],
+    "category": "Warehouse Management",
+    "demo": [],
+    "data": [],
     'test': [],
     'installable': True,
     'active': False,

=== modified file 'tr_barcode_field/barcode_field.py'
--- tr_barcode_field/barcode_field.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_field/barcode_field.py	2014-02-28 09:26:54 +0000
@@ -19,26 +19,25 @@
 #
 #################################################################################
 
-from osv import fields, orm
+from openerp.osv import orm
 
 class tr_barcode_installer(orm.TransientModel):
-
     _inherit = 'tr.barcode.settings'
 
     def install(self, cr, uid, ids, context=None):
         if context is None:
             context = {}
-        
+        if not ids:
+            return False
         model_obj = self.pool.get('ir.model')
         field_obj = self.pool.get('ir.model.fields')
-        
         for vals in self.read(cr, uid, ids, context=context):
-        
             if not vals or not vals.get('models_ids', False):
                 return False
-            
         read_datas = model_obj.read(cr, uid,
-                vals['models_ids'], ['model','name'], context=context)     
+                                    vals['models_ids'],
+                                    ['model','name'],
+                                    context=context)
         for model in read_datas:
             field_ids = field_obj.search(cr, uid, [
                                 ('name', '=', 'x_barcode_id'),

=== modified file 'tr_barcode_on_picking/__init__.py'
--- tr_barcode_on_picking/__init__.py	2013-02-14 13:49:55 +0000
+++ tr_barcode_on_picking/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,8 +19,8 @@
 #
 #################################################################################
 
-import picking
-import res_config
+from . import picking
+from . import res_config
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 

=== modified file 'tr_barcode_on_picking/__openerp__.py'
--- tr_barcode_on_picking/__openerp__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_picking/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -20,22 +20,25 @@
 #################################################################################
 
 {
-    "name" : "Barcode for pickings",
-    "version" : "1.1",
-    "author" : "Julius Network Solutions",
-    "website" : "http://www.julius.fr";,
-    "category" : "Warehouse Management",
-    "depends" : [
+    "name": "Barcode for pickings",
+    "version": "1.1",
+    "author": "Julius Network Solutions",
+    "website": "http://www.julius.fr";,
+    "category": "Warehouse Management",
+    "depends": [
         "stock",
         "tr_barcode_config",
         "tr_barcode_field",
     ],
-    "description" : """This module provides a stock.picking model deriving from barcode_osv, which will manage the population of the x_barcode_id column. 
+    "description": """
+This module provides a stock.picking model deriving from barcode_osv, which
+will manage the population of the x_barcode_id column.
 
-It is still necessary to configure the model to specify which field is used to generate the barcode.
+It is still necessary to configure the model to specify which field is used to
+generate the barcode.
      """,
-    "demo" : [],
-    "data" : [
+    "demo": [],
+    "data": [
         'data/model_data.xml',
         'data/config_data.xml',
         'res_config_view.xml',

=== modified file 'tr_barcode_on_picking/res_config.py'
--- tr_barcode_on_picking/res_config.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_picking/res_config.py	2014-02-28 09:26:54 +0000
@@ -24,38 +24,61 @@
 
 class tr_barcode_settings(orm.TransientModel):
     _inherit = 'tr.barcode.settings'
-    
+
     def _get_default_picking_config_id(self, cr, uid, context=None):
         config_obj = self.pool.get('tr.barcode.config')
         md_obj = self.pool.get('ir.model.data')
         model_id, res_id = md_obj.get_object_reference(cr, uid, 'stock', 'model_stock_picking')
         res = config_obj.search(cr, uid, [('res_model', '=', res_id)], limit=1, context=context)
         return res and res[0] or False
-    
+
     _columns = {
-        'picking_config_id': fields.many2one('tr.barcode.config', 'Picking Config'),
-        'picking_model_id': fields.related('picking_config_id', 'res_model', type='many2one', relation="ir.model", string="Model"),
-        'picking_field_id': fields.related('picking_config_id', 'field', type='many2one', relation="ir.model.fields", string="Field"),
-        'picking_width': fields.related('picking_config_id', 'width', type='integer', string="Width",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'picking_height': fields.related('picking_config_id', 'height', type='integer', string="Height",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'picking_hr_form': fields.related('picking_config_id', 'hr_form', type='boolean', string="Human Readable",
-                help="To generate Barcode In Human readable form"),
-        'picking_barcode_type': fields.related('picking_config_id', 'barcode_type', type='selection', selection=_get_code, string="Field"),
-    }
-    
+        'picking_config_id': fields.many2one('tr.barcode.config',
+                                             'Picking Config'),
+        'picking_model_id': fields.related('picking_config_id',
+                                           'res_model',
+                                           type='many2one',
+                                           relation="ir.model",
+                                           string="Model"),
+        'picking_field_id': fields.related('picking_config_id',
+                                           'field',
+                                           type='many2one',
+                                           relation="ir.model.fields",
+                                           string="Field"),
+        'picking_width': fields.related('picking_config_id',
+                                        'width',
+                                        type='integer',
+                                        string="Width",
+                                        help="Leave Blank or 0(ZERO) for default size"),
+        'picking_height': fields.related('picking_config_id',
+                                         'height',
+                                         type='integer',
+                                         string="Height",
+                                         help="Leave Blank or 0(ZERO) for default size"),
+        'picking_hr_form': fields.related('picking_config_id',
+                                          'hr_form',
+                                          type='boolean',
+                                          string="Human Readable",
+                                          help="To generate Barcode In Human readable form"),
+        'picking_barcode_type': fields.related('picking_config_id',
+                                               'barcode_type',
+                                               type='selection',
+                                               selection=_get_code,
+                                               string="Field"),
+        }
     _defaults = {
         'picking_config_id': _get_default_picking_config_id,
-    }
-    
-    def onchange_picking_config_id(self, cr, uid, ids, picking_config_id, context=None):
+        }
+
+    def onchange_picking_config_id(self, cr, uid, _ids, picking_config_id, context=None):
         values = {}
         if picking_config_id:
-            picking_config = self.pool.get('tr.barcode.config').browse(cr, uid, picking_config_id, context=context)
+            picking_config = self.pool.get('tr.barcode.config').browse(cr, uid,
+                                                                       picking_config_id,
+                                                                       context=context)
             values.update({
-                'picking_model_id': picking_config.res_model and picking_config.res_model.id or False,
-                'picking_field_id': picking_config.field and picking_config.field.id or False,
+                'picking_model_id': picking_config.res_model.id if picking_config.res_model else False,
+                'picking_field_id': picking_config.field.id if picking_config.field else False,
                 'picking_width': picking_config.width or 0,
                 'picking_height': picking_config.height or 0,
                 'picking_hr_form': picking_config.hr_form or False,
@@ -63,4 +86,4 @@
             })
         return {'value': values}
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_on_prodlots/__init__.py'
--- tr_barcode_on_prodlots/__init__.py	2013-02-14 13:49:55 +0000
+++ tr_barcode_on_prodlots/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,8 +19,8 @@
 #
 #################################################################################
 
-import prodlot
-import res_config
+from . import prodlot
+from . import res_config
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 

=== modified file 'tr_barcode_on_prodlots/__openerp__.py'
--- tr_barcode_on_prodlots/__openerp__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_prodlots/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -20,22 +20,25 @@
 #################################################################################
 
 {
-    "name" : "Barcode for production lots",
-    "version" : "1.1",
-    "author" : "Julius Network Solutions",
-    "website" : "http://www.julius.fr";,
-    "category" : "Warehouse Management",
-    "depends" : [
+    "name": "Barcode for production lots",
+    "version": "1.1",
+    "author": "Julius Network Solutions",
+    "website": "http://www.julius.fr";,
+    "category": "Warehouse Management",
+    "depends": [
         "stock",
         "tr_barcode_config",
         "tr_barcode_field",
     ],
-    "description" : """This module provides a stock.production.lot model deriving from barcode_osv, which will manage the population of the x_barcode_id column. 
+    "description": """
+This module provides a stock.production.lot model deriving from barcode_osv,
+which will manage the population of the x_barcode_id column.
 
-It is still necessary to configure the model to specify which field is used to generate the barcode.
+It is still necessary to configure the model to specify which field is used to
+generate the barcode.
      """,
-    "demo" : [],
-    "data" : [
+    "demo": [],
+    "data": [
         'data/model_data.xml',
         'data/config_data.xml',
         'res_config_view.xml',

=== modified file 'tr_barcode_on_prodlots/res_config.py'
--- tr_barcode_on_prodlots/res_config.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_prodlots/res_config.py	2014-02-28 09:26:54 +0000
@@ -24,43 +24,58 @@
 
 class tr_barcode_settings(orm.TransientModel):
     _inherit = 'tr.barcode.settings'
-    
+
     def _get_default_prodlot_config_id(self, cr, uid, context=None):
         config_obj = self.pool.get('tr.barcode.config')
         md_obj = self.pool.get('ir.model.data')
         model_id, res_id = md_obj.get_object_reference(cr, uid, 'stock', 'model_stock_production_lot')
         res = config_obj.search(cr, uid, [('res_model', '=', res_id)], limit=1, context=context)
         return res and res[0] or False
-    
+
     _columns = {
-        'prodlot_config_id': fields.many2one('tr.barcode.config', 'Production lot Config'),
-        'prodlot_model_id': fields.related('prodlot_config_id', 'res_model', type='many2one', relation="ir.model", string="Model"),
-        'prodlot_field_id': fields.related('prodlot_config_id', 'field', type='many2one', relation="ir.model.fields", string="Field"),
-        'prodlot_width': fields.related('prodlot_config_id', 'width', type='integer', string="Width",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'prodlot_height': fields.related('prodlot_config_id', 'height', type='integer', string="Height",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'prodlot_hr_form': fields.related('prodlot_config_id', 'hr_form', type='boolean', string="Human Readable",
-                help="To generate Barcode In Human readable form"),
-        'prodlot_barcode_type': fields.related('prodlot_config_id', 'barcode_type', type='selection', selection=_get_code, string="Field"),
-    }
-    
+        'prodlot_config_id': fields.many2one('tr.barcode.config',
+                                             'Production lot Config'),
+        'prodlot_model_id': fields.related('prodlot_config_id', 'res_model',
+                                           type='many2one',
+                                           relation="ir.model",
+                                           string="Model"),
+        'prodlot_field_id': fields.related('prodlot_config_id', 'field',
+                                           type='many2one',
+                                           relation="ir.model.fields",
+                                           string="Field"),
+        'prodlot_width': fields.related('prodlot_config_id', 'width',
+                                        type='integer',
+                                        string="Width",
+                                        help="Leave Blank or 0(ZERO) for default size"),
+        'prodlot_height': fields.related('prodlot_config_id', 'height',
+                                         type='integer',
+                                         string="Height",
+                help="Leave Blank or 0(ZERO) for default size"),
+        'prodlot_hr_form': fields.related('prodlot_config_id', 'hr_form',
+                                          type='boolean',
+                                          string="Human Readable",
+                                          help="To generate Barcode In Human readable form"),
+        'prodlot_barcode_type': fields.related('prodlot_config_id', 'barcode_type',
+                                               type='selection',
+                                               selection=_get_code,
+                                               string="Field"),
+        }
     _defaults = {
         'prodlot_config_id': _get_default_prodlot_config_id,
-    }
-    
+        }
+
     def onchange_prodlot_config_id(self, cr, uid, ids, prodlot_config_id, context=None):
         values = {}
         if prodlot_config_id:
             prodlot_config = self.pool.get('tr.barcode.config').browse(cr, uid, prodlot_config_id, context=context)
             values.update({
-                'prodlot_model_id': prodlot_config.res_model and prodlot_config.res_model.id or False,
-                'prodlot_field_id': prodlot_config.field and prodlot_config.field.id or False,
+                'prodlot_model_id': prodlot_config.res_model.id if prodlot_config.res_model else False,
+                'prodlot_field_id': prodlot_config.field.id if prodlot_config.field else False,
                 'prodlot_width': prodlot_config.width or 0,
                 'prodlot_height': prodlot_config.height or 0,
                 'prodlot_hr_form': prodlot_config.hr_form or False,
                 'prodlot_barcode_type': prodlot_config.barcode_type or False,
-            })
+                })
         return {'value': values}
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_on_product/__init__.py'
--- tr_barcode_on_product/__init__.py	2013-02-14 13:49:55 +0000
+++ tr_barcode_on_product/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,8 +19,8 @@
 #
 #################################################################################
 
-import product
-import res_config
+from . import product
+from . import res_config
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 

=== modified file 'tr_barcode_on_product/__openerp__.py'
--- tr_barcode_on_product/__openerp__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_product/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -20,22 +20,25 @@
 #################################################################################
 
 {
-    "name" : "Barcode for product",
-    "version" : "1.1",
-    "author" : "Julius Network Solutions",
-    "website" : "http://www.julius.fr";,
-    "category" : "Warehouse Management", 
-    "depends" : [
+    "name": "Barcode for product",
+    "version": "1.1",
+    "author": "Julius Network Solutions",
+    "website": "http://www.julius.fr";,
+    "category": "Warehouse Management",
+    "depends": [
         "product",
         "tr_barcode_config",
         "tr_barcode_field",
     ],
-    "description" : """This module provides a product.product model deriving from barcode_osv, which will manage the population of the x_barcode_id column. 
+    "description": """
+This module provides a product.product model deriving from barcode_osv, which
+will manage the population of the x_barcode_id column.
 
-It is still necessary to configure the model to specify which field is used to generate the barcode.
+It is still necessary to configure the model to specify which field is used to
+generate the barcode.
      """,
-    "demo" : [],
-    "data" : [
+    "demo": [],
+    "data": [
         'data/model_data.xml',
         'data/config_data.xml',
         'res_config_view.xml',

=== modified file 'tr_barcode_on_product/res_config.py'
--- tr_barcode_on_product/res_config.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_product/res_config.py	2014-02-28 09:26:54 +0000
@@ -24,43 +24,58 @@
 
 class tr_barcode_settings(orm.TransientModel):
     _inherit = 'tr.barcode.settings'
-    
+
     def _get_default_product_config_id(self, cr, uid, context=None):
         config_obj = self.pool.get('tr.barcode.config')
         md_obj = self.pool.get('ir.model.data')
         model_id, res_id = md_obj.get_object_reference(cr, uid, 'product', 'model_product_product')
         res = config_obj.search(cr, uid, [('res_model', '=', res_id)], limit=1, context=context)
         return res and res[0] or False
-    
+
     _columns = {
-        'product_config_id': fields.many2one('tr.barcode.config', 'Production lot Config'),
-        'product_model_id': fields.related('product_config_id', 'res_model', type='many2one', relation="ir.model", string="Model"),
-        'product_field_id': fields.related('product_config_id', 'field', type='many2one', relation="ir.model.fields", string="Field"),
-        'product_width': fields.related('product_config_id', 'width', type='integer', string="Width",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'product_height': fields.related('product_config_id', 'height', type='integer', string="Height",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'product_hr_form': fields.related('product_config_id', 'hr_form', type='boolean', string="Human Readable",
-                help="To generate Barcode In Human readable form"),
-        'product_barcode_type': fields.related('product_config_id', 'barcode_type', type='selection', selection=_get_code, string="Field"),
-    }
-    
+        'product_config_id': fields.many2one('tr.barcode.config',
+                                             'Production lot Config'),
+        'product_model_id': fields.related('product_config_id', 'res_model',
+                                           type='many2one',
+                                           relation="ir.model",
+                                           string="Model"),
+        'product_field_id': fields.related('product_config_id', 'field',
+                                           type='many2one',
+                                           relation="ir.model.fields",
+                                           string="Field"),
+        'product_width': fields.related('product_config_id', 'width',
+                                        type='integer',
+                                        string="Width",
+                                        help="Leave Blank or 0(ZERO) for default size"),
+        'product_height': fields.related('product_config_id', 'height',
+                                         type='integer',
+                                         string="Height",
+                                         help="Leave Blank or 0(ZERO) for default size"),
+        'product_hr_form': fields.related('product_config_id', 'hr_form',
+                                          type='boolean',
+                                          string="Human Readable",
+                                          help="To generate Barcode In Human readable form"),
+        'product_barcode_type': fields.related('product_config_id', 'barcode_type',
+                                               type='selection',
+                                               selection=_get_code,
+                                               string="Field"),
+        }
     _defaults = {
         'product_config_id': _get_default_product_config_id,
-    }
-    
-    def onchange_product_config_id(self, cr, uid, ids, product_config_id, context=None):
+        }
+
+    def onchange_product_config_id(self, cr, uid, _ids, product_config_id, context=None):
         values = {}
         if product_config_id:
             product_config = self.pool.get('tr.barcode.config').browse(cr, uid, product_config_id, context=context)
             values.update({
-                'product_model_id': product_config.res_model and product_config.res_model.id or False,
-                'product_field_id': product_config.field and product_config.field.id or False,
+                'product_model_id': product_config.res_model.id if product_config.res_model else False,
+                'product_field_id': product_config.field.id  if product_config.field else False,
                 'product_width': product_config.width or 0,
                 'product_height': product_config.height or 0,
                 'product_hr_form': product_config.hr_form or False,
                 'product_barcode_type': product_config.barcode_type or False,
-            })
+                })
         return {'value': values}
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'tr_barcode_on_tracking/__init__.py'
--- tr_barcode_on_tracking/__init__.py	2013-02-14 13:49:55 +0000
+++ tr_barcode_on_tracking/__init__.py	2014-02-28 09:26:54 +0000
@@ -19,8 +19,8 @@
 #
 #################################################################################
 
-import tracking
-import res_config
+from . import tracking
+from . import res_config
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 

=== modified file 'tr_barcode_on_tracking/__openerp__.py'
--- tr_barcode_on_tracking/__openerp__.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_tracking/__openerp__.py	2014-02-28 09:26:54 +0000
@@ -20,22 +20,25 @@
 #################################################################################
 
 {
-    "name" : "Barcode for tracking",
-    "version" : "1.1",
-    "author" : "Julius Network Solutions",
-    "website" : "http://www.julius.fr";,
-    "category" : "Warehouse Management",
-    "depends" : [
+    "name": "Barcode for tracking",
+    "version": "1.1",
+    "author": "Julius Network Solutions",
+    "website": "http://www.julius.fr";,
+    "category": "Warehouse Management",
+    "depends": [
         "stock",
         "tr_barcode_config",
         "tr_barcode_field",
     ],
-    "description" : """This module provides a stock.tracking model deriving from barcode_osv, which will manage the population of the x_barcode_id column. 
+    "description": """
+This module provides a stock.tracking model deriving from barcode_osv, which
+will manage the population of the x_barcode_id column.
 
-It is still necessary to configure the model to specify which field is used to generate the barcode.
+xIt is still necessary to configure the model to specify which field is used to
+generate the barcode.
      """,
-    "demo" : [],
-    "data" : [
+    "demo": [],
+    "data": [
         'data/model_data.xml',
         'data/config_data.xml',
         'res_config_view.xml',

=== modified file 'tr_barcode_on_tracking/res_config.py'
--- tr_barcode_on_tracking/res_config.py	2013-02-18 09:27:15 +0000
+++ tr_barcode_on_tracking/res_config.py	2014-02-28 09:26:54 +0000
@@ -24,43 +24,58 @@
 
 class tr_barcode_settings(orm.TransientModel):
     _inherit = 'tr.barcode.settings'
-    
+
     def _get_default_tracking_config_id(self, cr, uid, context=None):
         config_obj = self.pool.get('tr.barcode.config')
         md_obj = self.pool.get('ir.model.data')
         model_id, res_id = md_obj.get_object_reference(cr, uid, 'stock', 'model_stock_tracking')
         res = config_obj.search(cr, uid, [('res_model', '=', res_id)], limit=1, context=context)
         return res and res[0] or False
-    
+
     _columns = {
-        'tracking_config_id': fields.many2one('tr.barcode.config', 'Picking Config'),
-        'tracking_model_id': fields.related('tracking_config_id', 'res_model', type='many2one', relation="ir.model", string="Model"),
-        'tracking_field_id': fields.related('tracking_config_id', 'field', type='many2one', relation="ir.model.fields", string="Field"),
-        'tracking_width': fields.related('tracking_config_id', 'width', type='integer', string="Width",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'tracking_height': fields.related('tracking_config_id', 'height', type='integer', string="Height",
-                help="Leave Blank or 0(ZERO) for default size"),
-        'tracking_hr_form': fields.related('tracking_config_id', 'hr_form', type='boolean', string="Human Readable",
-                help="To generate Barcode In Human readable form"),
-        'tracking_barcode_type': fields.related('tracking_config_id', 'barcode_type', type='selection', selection=_get_code, string="Field"),
-    }
-    
+        'tracking_config_id': fields.many2one('tr.barcode.config',
+                                              'Picking Config'),
+        'tracking_model_id': fields.related('tracking_config_id', 'res_model',
+                                            type='many2one',
+                                            relation="ir.model",
+                                            string="Model"),
+        'tracking_field_id': fields.related('tracking_config_id', 'field',
+                                            type='many2one',
+                                            relation="ir.model.fields",
+                                            string="Field"),
+        'tracking_width': fields.related('tracking_config_id', 'width',
+                                         type='integer',
+                                         string="Width",
+                                         help="Leave Blank or 0(ZERO) for default size"),
+        'tracking_height': fields.related('tracking_config_id', 'height',
+                                          type='integer',
+                                          string="Height",
+                                          help="Leave Blank or 0(ZERO) for default size"),
+        'tracking_hr_form': fields.related('tracking_config_id', 'hr_form',
+                                           type='boolean',
+                                           string="Human Readable",
+                                           help="To generate Barcode In Human readable form"),
+        'tracking_barcode_type': fields.related('tracking_config_id', 'barcode_type',
+                                                type='selection',
+                                                selection=_get_code,
+                                                string="Field"),
+        }
     _defaults = {
         'tracking_config_id': _get_default_tracking_config_id,
-    }
-    
-    def onchange_tracking_config_id(self, cr, uid, ids, tracking_config_id, context=None):
+        }
+
+    def onchange_tracking_config_id(self, cr, uid, _ids, tracking_config_id, context=None):
         values = {}
         if tracking_config_id:
             tracking_config = self.pool.get('tr.barcode.config').browse(cr, uid, tracking_config_id, context=context)
             values.update({
-                'tracking_model_id': tracking_config.res_model and tracking_config.res_model.id or False,
-                'tracking_field_id': tracking_config.field and tracking_config.field.id or False,
+                'tracking_model_id': tracking_config.res_model.id if tracking_config.res_model else False,
+                'tracking_field_id': tracking_config.field.id if tracking_config.field else False,
                 'tracking_width': tracking_config.width or 0,
                 'tracking_height': tracking_config.height or 0,
                 'tracking_hr_form': tracking_config.hr_form or False,
                 'tracking_barcode_type': tracking_config.barcode_type or False,
-            })
+                })
         return {'value': values}
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:


References