Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化加工质检

# Conflicts:
#	sf_message/models/sf_message_maintenance_logs.py
This commit is contained in:
jinling.yang
2024-10-23 11:56:16 +08:00
22 changed files with 279 additions and 49 deletions

View File

@@ -1,3 +1,4 @@
import logging
import re
from odoo import models, fields, api, _
from urllib.parse import urlencode
@@ -35,19 +36,20 @@ class SFMessageMrpProduction(models.Model):
[('origin', '=', mrp_production.origin), ('picking_type_id.sequence_code', '=', 'SFP'),
('state', '=', 'assigned')], limit=1)
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(
'{{sale_order_name}}', mrp_production.origin).replace('{{request_url}}', url)
contents.append(content)
logging.info('生产完工入库提醒: %s' % contents)
return contents
def request_url(self):
def request_url(self, id):
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
# 查询参数
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.production',
'view_type': 'kanban'}
params = {'id': id, 'menu_id': menu_id, 'action': action_id, 'model': 'mrp.production',
'view_type': 'form'}
# 拼接查询参数
query_string = urlencode(params)
# 拼接URL

View File

@@ -1,3 +1,4 @@
import logging
import re
from odoo import models, fields, api, _
from urllib.parse import urlencode
@@ -40,9 +41,10 @@ class SFMessageStockPicking(models.Model):
('picking_type_id.sequence_code', '=', 'OUT')])
if stock_picking_out and len(stock_picking_out) > 0:
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(
'{{sale_order_name}}', stock_picking_out.origin).replace('{{request_url}}', url)
logging.info('订单发货提醒: %s' % content)
return content
def _get_message(self, message_queue_ids):
@@ -96,3 +98,16 @@ class SFMessageStockPicking(models.Model):
# 拼接URL
full_url = url + "/web#" + query_string
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

View File

@@ -12,7 +12,7 @@ class SFMessageWork(models.Model):
_name = 'mrp.workorder'
_inherit = ['mrp.workorder', 'jikimo.message.dispatch']
@api.depends('production_availability', 'blocked_by_workorder_ids.state')
@api.depends('production_availability', 'blocked_by_workorder_ids.state', 'production_id.tool_state')
def _compute_state(self):
super(SFMessageWork, self)._compute_state()
for workorder in self:
@@ -154,6 +154,6 @@ class SFMessageWork(models.Model):
getattr(item, queue_method_name)(*args)
def _recover_time_warning_func(self):
workorder_done = self.env['mrp.workorder'].search([("state", "=", "done")])
workorder_done = self.env['mrp.workorder'].search([("state", "in", ["done", "rework", "cancel"])])
workorder_overdue = workorder_done.filtered(lambda x: x.delivery_warning in ['overdue', 'warning'])
workorder_overdue.write({'delivery_warning': 'normal'})