解决冲突
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify','stock', 'sf_manufacturing', 'sf_hr'],
|
||||
'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify','stock', 'sf_tool_management', 'sf_manufacturing', 'sf_hr'],
|
||||
'data': [
|
||||
'data/bussiness_node.xml'
|
||||
'data/bussiness_node.xml',
|
||||
],
|
||||
'test': [
|
||||
],
|
||||
|
||||
@@ -8,7 +8,11 @@ class SFMessagefunctionalToolDismantle(models.Model):
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
# 判断是否为web页面创建请求
|
||||
is_web_request = self.env.context.get('params', False)
|
||||
result = super(SFMessagefunctionalToolDismantle, self).create(vals)
|
||||
if is_web_request and is_web_request.get('menu_id', False):
|
||||
return result
|
||||
for obj in result:
|
||||
if obj.dismantle_cause in ['寿命到期报废', '崩刀报废']and obj.state=='待拆解':
|
||||
obj.add_queue('功能刀具寿命到期')
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
class SFMessagePurchase(models.Model):
|
||||
_name = 'purchase.order'
|
||||
_inherit = ['purchase.order', 'jikimo.message.dispatch']
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
res = super(SFMessagePurchase, self).create(vals_list)
|
||||
if res:
|
||||
try:
|
||||
res.add_queue('坯料采购提醒')
|
||||
except Exception as e:
|
||||
logging.info('add_queue error:%s' % e)
|
||||
return res
|
||||
_inherit = ['purchase.order', 'jikimo.message.dispatch']
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
@@ -21,6 +22,18 @@ class SFMessageSale(models.Model):
|
||||
if res is True:
|
||||
try:
|
||||
self.add_queue('确认接单')
|
||||
picking_ids = self.mrp_production_ids
|
||||
purchase_order_id = []
|
||||
if picking_ids:
|
||||
for picking_id in picking_ids:
|
||||
purchase_order_ids = (
|
||||
picking_id.procurement_group_id.stock_move_ids.created_purchase_line_id.order_id |
|
||||
picking_id.procurement_group_id.stock_move_ids.move_orig_ids.purchase_line_id.order_id).ids
|
||||
purchase_order_id.extend(purchase_order_ids)
|
||||
if purchase_order_id:
|
||||
purchase_order_list = self.env['purchase.order'].search([('id', 'in', purchase_order_id)])
|
||||
for purchase_order_info in purchase_order_list:
|
||||
purchase_order_info.add_queue('坯料采购提醒')
|
||||
except Exception as e:
|
||||
logging.info('add_queue error:%s' % e)
|
||||
return res
|
||||
@@ -28,12 +41,20 @@ class SFMessageSale(models.Model):
|
||||
# 继承并重写jikimo.message.dispatch的_get_message()
|
||||
def _get_message(self, message_queue_ids):
|
||||
res = super(SFMessageSale, self)._get_message(message_queue_ids)
|
||||
if message_queue_ids.message_template_id.bussiness_node_id.name == '确认接单':
|
||||
# sale_order = self.env['sale.order'].search([('id', '=', message_queue_ids.model.res_id)])
|
||||
sale_order_line = self.env['sale.order.line'].search([('order_id', '=', int(message_queue_ids.res_id))])
|
||||
if len(sale_order_line) == 1:
|
||||
product = sale_order_line[0].product_id.name
|
||||
elif len(sale_order_line) > 1:
|
||||
product = '%s...' % sale_order_line[0].product_id.name
|
||||
res[0] = res[0].replace('{{product_id}}', product)
|
||||
new_res = []
|
||||
processed_messages = set() # 用于跟踪已经处理过的消息
|
||||
for item in message_queue_ids:
|
||||
if item.message_template_id.bussiness_node_id.name == '确认接单':
|
||||
sale_order_line = self.env['sale.order.line'].search([('order_id', '=', int(item.res_id))])
|
||||
if len(sale_order_line) == 1:
|
||||
product = sale_order_line[0].product_id.name
|
||||
elif len(sale_order_line) > 1:
|
||||
product = '%s...' % sale_order_line[0].product_id.name
|
||||
for message in res:
|
||||
message_text = message.replace('{{product_id}}', product)
|
||||
if message_text not in processed_messages:
|
||||
new_res.append(message_text)
|
||||
processed_messages.add(message_text)
|
||||
if new_res:
|
||||
res = new_res
|
||||
return res
|
||||
|
||||
@@ -7,11 +7,14 @@ class SFMessageStockPicking(models.Model):
|
||||
_description = "库存调拨"
|
||||
_inherit = ['stock.picking', 'jikimo.message.dispatch']
|
||||
|
||||
def button_validate(self):
|
||||
res = super(SFMessageStockPicking, self).button_validate()
|
||||
if self.location_id.name == 'Vendors' and self.location_dest_id.name == '进货':
|
||||
self.add_queue('调拨入库')
|
||||
return res
|
||||
@api.model_create_multi
|
||||
def create(self, vals):
|
||||
result = super(SFMessageStockPicking, self).create(vals)
|
||||
for obj in result:
|
||||
if obj.location_id.name == '进货' and obj.location_dest_id.name == '刀具房':
|
||||
obj.add_queue('调拨入库')
|
||||
return result
|
||||
|
||||
|
||||
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
|
||||
def _compute_state(self):
|
||||
@@ -43,7 +46,7 @@ class SFMessageStockPicking(models.Model):
|
||||
'{{number}}', str(i)).replace('{{request_url}}', url)
|
||||
product_id.append(mrp_production_info.product_id.id)
|
||||
contents.append(content)
|
||||
return contents
|
||||
else:
|
||||
res = super(SFMessageStockPicking, self)._get_message(message_queue_id)
|
||||
contents.append(res)
|
||||
return contents
|
||||
return res
|
||||
|
||||
@@ -12,8 +12,9 @@ class SFMessageWork(models.Model):
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids.state')
|
||||
def _compute_state(self):
|
||||
super(SFMessageWork, self)._compute_state()
|
||||
if self.state == 'ready' and self.routing_type == '装夹预调':
|
||||
self.add_queue('工单已下发通知')
|
||||
for workorder in self:
|
||||
if workorder.state == 'ready' and workorder.routing_type == '装夹预调':
|
||||
workorder.add_queue('工单已下发通知')
|
||||
|
||||
def _get_message(self, message_queue_ids):
|
||||
contents = []
|
||||
|
||||
Reference in New Issue
Block a user