stock_warehouse.py 538 B

12345678910111213141516171819202122
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_warehouses():
  4. return [
  5. {
  6. 'id': w.id,
  7. 'name': w.display_name,
  8. 'locationStock': {
  9. 'id': w.lot_stock_id.id,
  10. 'name': w.lot_stock_id.display_name
  11. }
  12. } for w in r.env.user.store_id.warehouse_ids
  13. ]
  14. def get_location_id(warehouse_id):
  15. if not warehouse_id:
  16. return None
  17. return r.env.user.store_id.warehouse_ids.filtered(lambda x: x.id == warehouse_id).id