修改生成完工入库提醒,订单发货提醒跳转到表单详情
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
@@ -35,19 +36,20 @@ class SFMessageMrpProduction(models.Model):
|
|||||||
[('origin', '=', mrp_production.origin), ('picking_type_id.sequence_code', '=', 'SFP'),
|
[('origin', '=', mrp_production.origin), ('picking_type_id.sequence_code', '=', 'SFP'),
|
||||||
('state', '=', 'assigned')], limit=1)
|
('state', '=', 'assigned')], limit=1)
|
||||||
if stock_picking_sfp:
|
if stock_picking_sfp:
|
||||||
url = self.request_url()
|
url = self.request_url(stock_picking_sfp.id)
|
||||||
content = content.replace('{{name}}', stock_picking_sfp.name).replace(
|
content = content.replace('{{name}}', stock_picking_sfp.name).replace(
|
||||||
'{{sale_order_name}}', mrp_production.origin).replace('{{request_url}}', url)
|
'{{sale_order_name}}', mrp_production.origin).replace('{{request_url}}', url)
|
||||||
contents.append(content)
|
contents.append(content)
|
||||||
|
logging.info('生产完工入库提醒: %s' % contents)
|
||||||
return contents
|
return contents
|
||||||
|
|
||||||
def request_url(self):
|
def request_url(self, id):
|
||||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||||
action_id = self.env.ref('mrp.mrp_production_action').id
|
action_id = self.env.ref('stock.action_picking_tree_all').id
|
||||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
||||||
# 查询参数
|
# 查询参数
|
||||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.production',
|
params = {'id': id, 'menu_id': menu_id, 'action': action_id, 'model': 'mrp.production',
|
||||||
'view_type': 'kanban'}
|
'view_type': 'form'}
|
||||||
# 拼接查询参数
|
# 拼接查询参数
|
||||||
query_string = urlencode(params)
|
query_string = urlencode(params)
|
||||||
# 拼接URL
|
# 拼接URL
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
@@ -40,9 +41,10 @@ class SFMessageStockPicking(models.Model):
|
|||||||
('picking_type_id.sequence_code', '=', 'OUT')])
|
('picking_type_id.sequence_code', '=', 'OUT')])
|
||||||
if stock_picking_out and len(stock_picking_out) > 0:
|
if stock_picking_out and len(stock_picking_out) > 0:
|
||||||
content = message_queue_id.message_template_id.content
|
content = message_queue_id.message_template_id.content
|
||||||
url = self.request_url()
|
url = self.request_url1(stock_picking_out.id)
|
||||||
content = content.replace('{{name}}', stock_picking_out.name).replace(
|
content = content.replace('{{name}}', stock_picking_out.name).replace(
|
||||||
'{{sale_order_name}}', stock_picking_out.origin).replace('{{request_url}}', url)
|
'{{sale_order_name}}', stock_picking_out.origin).replace('{{request_url}}', url)
|
||||||
|
logging.info('订单发货提醒: %s' % content)
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def _get_message(self, message_queue_ids):
|
def _get_message(self, message_queue_ids):
|
||||||
@@ -96,3 +98,16 @@ class SFMessageStockPicking(models.Model):
|
|||||||
# 拼接URL
|
# 拼接URL
|
||||||
full_url = url + "/web#" + query_string
|
full_url = url + "/web#" + query_string
|
||||||
return full_url
|
return full_url
|
||||||
|
|
||||||
|
def request_url1(self, id):
|
||||||
|
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||||
|
action_id = self.env.ref('stock.action_picking_tree_all').id
|
||||||
|
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
||||||
|
# 查询参数
|
||||||
|
params = {'id': id, 'menu_id': menu_id, 'action': action_id, 'model': 'stock.picking',
|
||||||
|
'view_type': 'form'}
|
||||||
|
# 拼接查询参数
|
||||||
|
query_string = urlencode(params)
|
||||||
|
# 拼接URL
|
||||||
|
full_url = url + "/web#" + query_string
|
||||||
|
return full_url
|
||||||
|
|||||||
Reference in New Issue
Block a user