单已下发通知

This commit is contained in:
guanhuan
2024-09-24 10:56:23 +08:00
parent 378850682d
commit 36c1c7b170
4 changed files with 44 additions and 8 deletions

View File

@@ -23,16 +23,23 @@ class SFMessageStockPicking(models.Model):
contents = []
product_id = []
for message_queue_id in message_queue_ids:
i = 0
if message_queue_id.message_template_id.name == '坯料发料提醒':
content = message_queue_id.message_template_id.content
stock_picking_line = self.env['stock.picking'].search([('id', '=', int(message_queue_id.res_id))])
stock_picking_info = self.env['stock.picking'].search(
[('product_id', '=', stock_picking_line.product_id.id), ('state', '=', 'assigned'),
('check_in', '=', 'PC')])
if stock_picking_info and stock_picking_info.product_id.id not in product_id:
content = content.replace('{{product_id}}', stock_picking_info.product_id.name)
content = content.replace('{{number}}', str(len(stock_picking_info)))
product_id.append(stock_picking_info.product_id.id)
mrp_production_info = self.env['mrp.production'].search(
[('name', '=', stock_picking_line.origin)])
mrp_production_list = self.env['mrp.production'].search(
[('product_id', '=', mrp_production_info.product_id.id)])
for mrp_production_line in mrp_production_list:
picking_ids = mrp_production_line.picking_ids
for picking_id in picking_ids:
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:
content = content.replace('{{product_id}}', mrp_production_info.product_id.name).replace(
'{{number}}', str(i))
product_id.append(mrp_production_info.product_id.id)
contents.append(content)
else:
res = super(SFMessageStockPicking, self)._get_message(message_queue_id)