diff options
| author | Christophe Simonis <chs@openerp.com> | 2014-04-24 15:45:33 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@openerp.com> | 2014-04-24 15:45:33 +0200 |
| commit | 7a7d7febf8d51cdc693e77678fc9eaee3864b3b2 (patch) | |
| tree | d2bb635b1441f04267727e39a4bfbd219a4b7b6b /addons/procurement/procurement.py | |
| parent | 96b9d8b9d59dc7b240a096e6c6775c7a45ac88c4 (diff) | |
| parent | 52cfc16c2e2f33395a53b255825a8153ec80ce40 (diff) | |
[MERGE] forward port of branch saas-3 up to revid 9429 chs@openerp.com-20140424123538-rxk9got9k2on1ki1
bzr revid: chs@openerp.com-20140424131824-4ksluvhnegp7kplb
bzr revid: chs@openerp.com-20140424134533-lhhcd32n3s0m9cqk
Diffstat (limited to 'addons/procurement/procurement.py')
| -rw-r--r-- | addons/procurement/procurement.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 1e7076d9c8f..e7a2e6a1c86 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -558,14 +558,14 @@ class stock_warehouse_orderpoint(osv.osv): ] def default_get(self, cr, uid, fields, context=None): + warehouse_obj = self.pool.get('stock.warehouse') 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 = res.get('company_id') and warehouse_obj.search(cr, uid, [('company_id', '=', res['company_id'])], limit=1, context=context) or [] + 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'] = res.get('warehouse_id') and warehouse_obj.browse(cr, uid, res['warehouse_id'], context).lot_stock_id.id or False return res def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context=None): |
