消息提醒
This commit is contained in:
@@ -72,8 +72,8 @@
|
|||||||
<field name="msgtype">markdown</field>
|
<field name="msgtype">markdown</field>
|
||||||
<field name="urgency">normal</field>
|
<field name="urgency">normal</field>
|
||||||
<field name="content">### 坯料发料提醒:
|
<field name="content">### 坯料发料提醒:
|
||||||
单号:产品[{{product_id}}]({{request_url}})
|
单号:发料单[{{name}}]({{request_url}})
|
||||||
事项:共{{number}}个生产发料单待确认处理</field>
|
事项:请确认坯料发料单并处理</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="template_mrp_workorder_remind" model="jikimo.message.template">
|
<record id="template_mrp_workorder_remind" model="jikimo.message.template">
|
||||||
|
|||||||
@@ -49,26 +49,18 @@ class SFMessageStockPicking(models.Model):
|
|||||||
|
|
||||||
def _get_message(self, message_queue_ids):
|
def _get_message(self, message_queue_ids):
|
||||||
contents = []
|
contents = []
|
||||||
product_id = []
|
|
||||||
for message_queue_id in message_queue_ids:
|
for message_queue_id in message_queue_ids:
|
||||||
i = 0
|
|
||||||
if message_queue_id.message_template_id.name == '坯料发料提醒':
|
if message_queue_id.message_template_id.name == '坯料发料提醒':
|
||||||
content = message_queue_id.message_template_id.content
|
content = message_queue_id.message_template_id.content
|
||||||
stock_picking_line = self.env['stock.picking'].sudo().search([('id', '=', int(message_queue_id.res_id))])
|
stock_picking_line = self.env['stock.picking'].sudo().search(
|
||||||
mrp_production_info = self.env['mrp.production'].sudo().search(
|
[('id', '=', int(message_queue_id.res_id))])
|
||||||
[('name', '=', stock_picking_line.origin)])
|
if stock_picking_line.state == 'assigned':
|
||||||
mrp_production_list = self.env['mrp.production'].sudo().search(
|
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||||
[('product_id', '=', mrp_production_info.product_id.id)])
|
action_id = self.env.ref('stock.action_picking_tree_ready').id
|
||||||
for mrp_production_line in mrp_production_list:
|
menu_id = self.env['ir.model.data'].sudo().search([('name', '=', 'module_theme_treehouse')]).id
|
||||||
picking_ids = mrp_production_line.picking_ids
|
url_with_id = f"{url}/web#view_type=form&action={action_id}&menu_id={menu_id}&id={stock_picking_line.id}"
|
||||||
for picking_id in picking_ids:
|
content = content.replace('{{name}}', stock_picking_line.name).replace(
|
||||||
if picking_id.state == 'assigned' and picking_id.check_in == 'PC':
|
'{{request_url}}', url_with_id)
|
||||||
i += 1
|
|
||||||
if i > 0 and mrp_production_info.product_id.id not in product_id:
|
|
||||||
url = self.request_url()
|
|
||||||
content = content.replace('{{product_id}}', mrp_production_info.product_id.name).replace(
|
|
||||||
'{{number}}', str(i)).replace('{{request_url}}', url)
|
|
||||||
product_id.append(mrp_production_info.product_id.id)
|
|
||||||
contents.append(content)
|
contents.append(content)
|
||||||
elif message_queue_id.message_template_id.name == '订单发货提醒':
|
elif message_queue_id.message_template_id.name == '订单发货提醒':
|
||||||
content = self.deal_stock_picking_sfp(message_queue_id)
|
content = self.deal_stock_picking_sfp(message_queue_id)
|
||||||
@@ -86,19 +78,6 @@ class SFMessageStockPicking(models.Model):
|
|||||||
else:
|
else:
|
||||||
return super(SFMessageStockPicking, self).get_special_url(id, tmplate_name, special_name, model_id)
|
return super(SFMessageStockPicking, self).get_special_url(id, tmplate_name, special_name, model_id)
|
||||||
|
|
||||||
def request_url(self):
|
|
||||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
|
||||||
action_id = self.env.ref('stock.stock_picking_type_action').id
|
|
||||||
menu_id = self.env['ir.model.data'].sudo().search([('name', '=', 'module_theme_treehouse')]).id
|
|
||||||
# 查询参数
|
|
||||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'stock.picking',
|
|
||||||
'view_type': 'kanban'}
|
|
||||||
# 拼接查询参数
|
|
||||||
query_string = urlencode(params)
|
|
||||||
# 拼接URL
|
|
||||||
full_url = url + "/web#" + query_string
|
|
||||||
return full_url
|
|
||||||
|
|
||||||
def request_url1(self, id):
|
def request_url1(self, id):
|
||||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||||
action_id = self.env.ref('stock.action_picking_tree_all').id
|
action_id = self.env.ref('stock.action_picking_tree_all').id
|
||||||
|
|||||||
Reference in New Issue
Block a user