消息通知url修改
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
from odoo import models, fields, api, _
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
||||
class SFMessageStockPicking(models.Model):
|
||||
@@ -41,7 +42,7 @@ class SFMessageStockPicking(models.Model):
|
||||
if picking_id.state == 'assigned' and picking_id.check_in == 'PC':
|
||||
i += 1
|
||||
if i > 0 and mrp_production_info.product_id.id not in product_id:
|
||||
url = message_queue_id.message_template_id.get_url(int(message_queue_id.res_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)
|
||||
@@ -50,3 +51,18 @@ class SFMessageStockPicking(models.Model):
|
||||
else:
|
||||
res = super(SFMessageStockPicking, self)._get_message(message_queue_id)
|
||||
return res
|
||||
|
||||
def request_url(self):
|
||||
we_config_info = self.env['we.config'].sudo().search([], limit=1)
|
||||
redirect_domain = self.env['we.app'].sudo().search([('id', '=', we_config_info.odoo_app_id.id)]).redirect_domain
|
||||
full_url = 'https://%s/' % redirect_domain
|
||||
action_id = self.env.ref('stock.action_picking_tree_ready').id
|
||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
||||
# 查询参数
|
||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'stock.picking',
|
||||
'view_type': 'list'}
|
||||
# 拼接查询参数
|
||||
query_string = urlencode(params)
|
||||
# 拼接URL
|
||||
full_url = full_url + "web#" + query_string
|
||||
return full_url
|
||||
|
||||
Reference in New Issue
Block a user