123456789101112131415161718192021222324252627 |
- # -*- coding: utf-8 -*-
- from openerp.http import request as req
- def get_warehouses():
- return [
- {
- 'id': w.id,
- 'name': w.display_name,
- 'locationStock': {
- 'id': w.lot_stock_id.id,
- 'name': w.lot_stock_id.display_name
- }
- } for w in req.env.user.store_id.warehouse_ids
- ]
- def get_location_id(warehouse_id):
- if not warehouse_id:
- return None
- store_id = req.env.user.store_id
- if len(store_id) == 0:
- store_id = req.env['res.store'].search([])[0]
- return store_id.warehouse_ids.filtered(lambda x: x.id == warehouse_id).lot_stock_id.id
|