坯料发料提醒
This commit is contained in:
@@ -26,5 +26,9 @@
|
|||||||
<field name="name">坯料采购提醒</field>
|
<field name="name">坯料采购提醒</field>
|
||||||
<field name="model">purchase.order</field>
|
<field name="model">purchase.order</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="bussiness_material_picking_remind" model="jikimo.message.bussiness.node">
|
||||||
|
<field name="name">坯料发料提醒</field>
|
||||||
|
<field name="model">stock.picking</field>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import re
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
@@ -11,3 +12,28 @@ class SFMessageStockPicking(models.Model):
|
|||||||
if self.location_id.name == '进货' and self.location_dest_id.name == '刀具房':
|
if self.location_id.name == '进货' and self.location_dest_id.name == '刀具房':
|
||||||
self.add_queue('调拨入库')
|
self.add_queue('调拨入库')
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
|
||||||
|
def _compute_state(self):
|
||||||
|
super(SFMessageStockPicking, self)._compute_state()
|
||||||
|
if self.state == 'assigned' and self.check_in == 'PC':
|
||||||
|
self.add_queue('坯料发料提醒')
|
||||||
|
|
||||||
|
def _get_message(self, message_queue_ids):
|
||||||
|
contents = []
|
||||||
|
product_id = []
|
||||||
|
for message_queue_id in message_queue_ids:
|
||||||
|
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)
|
||||||
|
contents.append(content)
|
||||||
|
res = super(SFMessageStockPicking, self)._get_message(message_queue_ids)
|
||||||
|
contents.append(res)
|
||||||
|
return contents
|
||||||
|
|||||||
Reference in New Issue
Block a user