From 58fb9394368d0dc976cbe7b5ce684e3e3810fc82 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 18 Nov 2014 10:45:21 +0100 Subject: [PATCH] [FIX] stock, point_of_sale: required='True' replaced by required=True in barcode_nomenclature_id field definition and _get_default_nomenclature function refactored Conflicts: addons/point_of_sale/point_of_sale.py --- addons/point_of_sale/point_of_sale.py | 6 ++---- addons/stock/stock.py | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 360a36c436f..f48f800d178 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -91,7 +91,7 @@ class pos_config(osv.osv): 'group_by' : fields.boolean('Group Journal Items', help="Check this if you want to group the Journal Items by Product while closing a Session"), 'pricelist_id': fields.many2one('product.pricelist','Pricelist', required=True), 'company_id': fields.many2one('res.company', 'Company', required=True), - 'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcode Nomenclature', help='A barcode nomenclature', required="True"), + 'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcode Nomenclature', help='A barcode nomenclature', required=True), 'group_pos_manager_id': fields.many2one('res.groups','Point of Sale Manager Group', help='This field is there to pass the id of the pos manager group to the point of sale client'), 'group_pos_user_id': fields.many2one('res.groups','Point of Sale User Group', help='This field is there to pass the id of the pos user group to the point of sale client'), } @@ -174,9 +174,7 @@ class pos_config(osv.osv): def _get_default_nomenclature(self, cr, uid, context=None): nom_obj = self.pool.get('barcode.nomenclature') res = nom_obj.search(cr, uid, [], limit=1, context=context) - if res and res[0]: - return nom_obj.browse(cr, uid, res[0], context=context).id - return False + return res and res[0] or False def _get_group_pos_manager(self, cr, uid, context=None): group = self.pool.get('ir.model.data').get_object_reference(cr,uid,'point_of_sale','group_pos_manager') diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 64aa3e97444..9285cd2532b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -819,15 +819,13 @@ class stock_picking(osv.osv): 'stock.picking': (lambda self, cr, uid, ids, ctx: ids, ['move_lines'], 10), 'stock.move': (_get_pickings, ['group_id', 'picking_id'], 10), }), - 'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcode Nomenclature', help='A barcode nomenclature', required="True"), + 'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcode Nomenclature', help='A barcode nomenclature', required=True), } def _get_default_nomenclature(self, cr, uid, context=None): nom_obj = self.pool.get('barcode.nomenclature') res = nom_obj.search(cr, uid, [], limit=1, context=context) - if res and res[0]: - return nom_obj.browse(cr, uid, res[0], context=context).id - return False + return res and res[0] or False _defaults = { 'name': '/',