消息提醒
This commit is contained in:
@@ -135,5 +135,10 @@
|
||||
<field name="name">工序外协采购单通知</field>
|
||||
<field name="model">purchase.order</field>
|
||||
</record>
|
||||
|
||||
<record id="bussiness_outsourced_outbound" model="jikimo.message.bussiness.node">
|
||||
<field name="name">工序外协发料通知</field>
|
||||
<field name="model">mrp.production</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -347,8 +347,20 @@
|
||||
<field name="msgtype">markdown</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工序外协采购单通知:
|
||||
单号:工序外协采购单产品[{{name}}]({{url}})
|
||||
事项:有{{num}}个工序外协采购单需要确认。</field>
|
||||
单号:工序外协采购,产品[{{name}}]({{url}})
|
||||
事项:请确认{{num}}个工序外协采购单并处理。</field>
|
||||
</record>
|
||||
|
||||
<record id="template_outsourced_outbound_remind" model="jikimo.message.template">
|
||||
<field name="name">工序外协发料通知</field>
|
||||
<field name="model_id" ref="mrp.model_mrp_production"/>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="bussiness_node_id" ref="bussiness_outsourced_outbound"/>
|
||||
<field name="msgtype">markdown</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 工序外协发料提醒:
|
||||
单号:产品[{{name}}]({{url}})发料单
|
||||
事项:请确认{{num}}个工序外协发料单并发料处理。</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -50,6 +50,22 @@ class SFMessageMrpProduction(models.Model):
|
||||
content = message_queue_id.message_template_id.content
|
||||
mrp_production = self.env['mrp.production'].sudo().search([('id', '=', int(message_queue_id.res_id))])
|
||||
unique_products.add(mrp_production.product_id.id)
|
||||
if message_queue_id.message_template_id.name == '工序外协发料通知':
|
||||
content = message_queue_id.message_template_id.content
|
||||
mrp_production = self.env['mrp.production'].sudo().search([('id', '=', int(message_queue_id.res_id))])
|
||||
mrp_production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', mrp_production.product_id.id)])
|
||||
mrp_production_names = mrp_production_list.mapped('name')
|
||||
stock_picking_num = self.env['stock.picking'].sudo().search_count(
|
||||
[('origin', 'in', mrp_production_names), ('state', '=', 'assigned')])
|
||||
if stock_picking_num >= 1:
|
||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
action_id = self.env.ref('stock.action_picking_tree_ready').id
|
||||
url_with_id = f"{url}/web#view_type=list&action={action_id}"
|
||||
content = content.replace('{{name}}', mrp_production.product_id.name).replace('{{url}}',
|
||||
url_with_id).replace(
|
||||
'{{num}}', str(stock_picking_num))
|
||||
contents.append(content)
|
||||
if unique_products:
|
||||
unique_products_contents = self.get_production_info(content, unique_products, 'confirmed',
|
||||
'sf_plan.sf_production_plan_action1')
|
||||
@@ -83,7 +99,7 @@ class SFMessageMrpProduction(models.Model):
|
||||
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': 'mrp.production',
|
||||
params = {'id': id, 'menu_id': menu_id, 'action': action_id, 'model': 'mrp.production',
|
||||
'view_type': 'form'}
|
||||
# 拼接查询参数
|
||||
query_string = urlencode(params)
|
||||
|
||||
@@ -21,7 +21,7 @@ class SFMessageStockPicking(models.Model):
|
||||
def _compute_state(self):
|
||||
super(SFMessageStockPicking, self)._compute_state()
|
||||
for record in self:
|
||||
if record.state == 'assigned' and record.check_in == 'PC':
|
||||
if record.state == 'assigned' and record.picking_type_id.sequence_code == 'PC':
|
||||
record.add_queue('坯料发料提醒')
|
||||
|
||||
if record.picking_type_id.sequence_code == 'SFP' and record.state == 'done':
|
||||
@@ -32,6 +32,16 @@ class SFMessageStockPicking(models.Model):
|
||||
stock_picking_send = self.env["jikimo.message.queue"].sudo().search([('res_id', '=', record.id)])
|
||||
if not stock_picking_send:
|
||||
record.add_queue('订单发货提醒')
|
||||
if record.picking_type_id.sequence_code == 'OCOUT' and record.state == 'assigned':
|
||||
mrp_production = self.env['mrp.production'].sudo().search([('name', '=', record.origin)])
|
||||
production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', mrp_production.product_id.id)])
|
||||
manufacturing_order_names = production_list.mapped('name')
|
||||
stock_picking_list = self.env['stock.picking'].sudo().search(
|
||||
[('origin', 'in', manufacturing_order_names), ('picking_type_id.sequence_code', '=', 'OCOUT')])
|
||||
all_ready_or_done = all(picking.state in ['assigned', 'done'] for picking in stock_picking_list)
|
||||
if all_ready_or_done:
|
||||
mrp_production.add_queue('工序外协发料通知')
|
||||
|
||||
def deal_stock_picking_sfp(self, message_queue_id): # 处理订单发货提醒
|
||||
content = None
|
||||
|
||||
Reference in New Issue
Block a user