[FIX] procurement: User belonging to the company other then the 'Your Company' would...
authorRavi Gohil (OpenERP) <rgo@tinyerp.com>
Wed, 18 Sep 2013 09:09:05 +0000 (14:39 +0530)
committerRavi Gohil (OpenERP) <rgo@tinyerp.com>
Wed, 18 Sep 2013 09:09:05 +0000 (14:39 +0530)
lp bug: https://launchpad.net/bugs/1212429 fixed

bzr revid: rgo@tinyerp.com-20130918090905-wkby3xazxbwoih90

1  2 
addons/procurement/procurement.py

@@@ -550,11 -551,10 +551,10 @@@ class stock_warehouse_orderpoint(osv.os
          res = super(stock_warehouse_orderpoint, self).default_get(cr, uid, fields, context)
          # default 'warehouse_id' and 'location_id'
          if 'warehouse_id' not in res:
-             warehouse = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'warehouse0', context)
-             res['warehouse_id'] = warehouse.id
+             warehouse_ids = warehouse_obj.search(cr, uid, [('company_id', '=', res.get('company_id'))], context=context)
+             res['warehouse_id'] = warehouse_ids and warehouse_ids[0] or False
          if 'location_id' not in res:
-             warehouse = self.pool.get('stock.warehouse').browse(cr, uid, res['warehouse_id'], context)
-             res['location_id'] = warehouse.lot_stock_id.id
 -            res['location_id'] = False if not res.get('warehouse_id') else self.pool.get('stock.warehouse').browse(cr, uid, res['warehouse_id'], context).lot_stock_id.id
++            res['location_id'] = False if not res.get('warehouse_id') else warehouse_obj.browse(cr, uid, res['warehouse_id'], context).lot_stock_id.id
          return res
  
      def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context=None):