Accept Merge Request #1788: (feature/工单返工优化 -> develop)
Merge Request: 人工线下加工工单下发通知修改 Created By: @管欢 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @管欢 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1788
This commit is contained in:
@@ -16,6 +16,7 @@ class SFMessageProduct(models.Model):
|
||||
mrp_production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', product_product.id)])
|
||||
production_num = 0
|
||||
routing_type = None
|
||||
for mrp_production_info in mrp_production_list:
|
||||
routing_type = '人工线下加工' if mrp_production_info.production_type == '人工线下加工' else '装夹预调'
|
||||
mrp_production_ready = mrp_production_info.workorder_ids.filtered(
|
||||
@@ -23,7 +24,7 @@ class SFMessageProduct(models.Model):
|
||||
if mrp_production_ready:
|
||||
production_num += 1
|
||||
if production_num >= 1:
|
||||
url = self.get_request_url()
|
||||
url = self.get_request_url(routing_type)
|
||||
content = content.replace('{{product_id}}', product_product.name).replace(
|
||||
'{{number}}', str(production_num)).replace(
|
||||
'{{request_url}}', url)
|
||||
@@ -42,11 +43,15 @@ class SFMessageProduct(models.Model):
|
||||
contents.append(content)
|
||||
return contents, message_queue_ids
|
||||
|
||||
def get_request_url(self):
|
||||
def get_request_url(self, routing_type):
|
||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
action_id = self.env.ref('sf_message.mrp_workorder_issued_action').id
|
||||
menu_id = self.env.ref('mrp.menu_mrp_root').id
|
||||
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', '工件装夹中心')]).id
|
||||
if routing_type == '人工线下加工':
|
||||
routing_name = '线下工作中心'
|
||||
else:
|
||||
routing_name = '工件装夹中心'
|
||||
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', routing_name)]).id
|
||||
# 查询参数
|
||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
||||
'view_type': 'list', 'active_id': active_id}
|
||||
|
||||
Reference in New Issue
Block a user