Commit ea82a21b by 夏超

Merge remote-tracking branch 'origin/sdddl_project' into sdddl_project

parents 0e44b988 aee1da2b
...@@ -30,27 +30,29 @@ class InheritEntrustOrderMain(Main): ...@@ -30,27 +30,29 @@ class InheritEntrustOrderMain(Main):
}) })
return res return res
@http.route('/entrust/send/product', type='json', method=["POST", "OPTIONS"], auth='user', cors='*', csrf=False) # @http.route('/entrust/send/product', type='json', method=["POST", "OPTIONS"], auth='user', cors='*', csrf=False)
def entrust_send_product(self): # def entrust_send_product(self):
res = super(InheritEntrustOrderMain, self).entrust_send_product() # res = super(InheritEntrustOrderMain, self).entrust_send_product()
work_id = http.request.jsonrequest.get('work_id') # work_id = http.request.jsonrequest.get('work_id')
if work_id: # if work_id:
work_order = http.request.env['roke.work.order'].search([('id', '=', int(work_id))]) # work_order = http.request.env['roke.work.order'].search([('id', '=', int(work_id))])
product_list = self._prepare_entrust_send_product_from_process(work_order.process_id, work_order) # default_routing = work_order.product_id.routing_id
res.update({"info": product_list}) # bom_line = default_routing.line_ids.filtered(lambda r: r.process_id == work_order.process_id)
return res # product_list = self._prepare_entrust_send_product_from_process(bom_line, work_order)
# res.update({"info": product_list})
def _prepare_entrust_send_product_from_process(self, process, work_order): # return res
"""准备接口/entrust/send/product中的product_list数据""" #
product_list = [] # def _prepare_entrust_send_product_from_process(self, bom_line, work_order):
for i in process.p_bom_ids: # """准备接口/entrust/send/product中的product_list数据"""
product_list.append({ # product_list = []
"product_id": i.product_id.id, # for i in bom_line.p_bom_ids:
"product_name": i.product_id.name, # product_list.append({
"qty": i.qty * work_order.plan_qty, # "product_id": i.product_id.id,
"note": i.note if i.note != False else '' # "product_name": i.product_id.name,
}) # "qty": i.qty * work_order.plan_qty,
return product_list # "note": i.note if i.note != False else ''
# })
# return product_list
def _prepare_entrust_info_data(self, entrust_orders): def _prepare_entrust_info_data(self, entrust_orders):
info = [] info = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment