还原代码
This commit is contained in:
@@ -4,12 +4,12 @@ class SFMessageMaintenanceLogs(models.Model):
|
||||
_name = 'sf.maintenance.logs'
|
||||
_inherit = ['sf.maintenance.logs', 'jikimo.message.dispatch']
|
||||
|
||||
# @api._model_create_multi
|
||||
# def create(self, vals_list):
|
||||
# res = super(SFMessageMaintenanceLogs, self).create(vals_list)
|
||||
# for rec in res:
|
||||
# rec.add_queue()
|
||||
# return res
|
||||
@api._model_create_multi
|
||||
def create(self, vals_list):
|
||||
res = super(SFMessageMaintenanceLogs, self).create(vals_list)
|
||||
for rec in res:
|
||||
rec.add_queue()
|
||||
return res
|
||||
|
||||
def _get_message(self, message_queue_ids):
|
||||
contents = super(SFMessageMaintenanceLogs, self)._get_message(message_queue_ids)
|
||||
|
||||
@@ -103,23 +103,35 @@ class SFMessageSale(models.Model):
|
||||
today = datetime.today().date()
|
||||
deadline_check = today + timedelta(days=1)
|
||||
logging.info(f"today: {today}, deadline_check: {deadline_check}")
|
||||
sale_order = self.sudo().search([('state', 'in', ['sale']), ('deadline_of_delivery', '!=', False)])
|
||||
sale_order = self.sudo().search(
|
||||
[('state', 'in', ['sale']), ('deadline_of_delivery', '!=', False), ('delivery_status', '!=', 'full')])
|
||||
for item in sale_order:
|
||||
production = self.env['mrp.production'].search([('origin', '=', item.name)])
|
||||
production_not_done = production.filtered(lambda p: p.state not in ['done', 'scrap', 'cancel'])
|
||||
production_done_count = len(production.filtered(lambda p: p.state in ['done', 'scrap', 'cancel']))
|
||||
if len(production_not_done) != item.mrp_production_count:
|
||||
if len(production_not_done) >= 1 and len(production_not_done) != item.mrp_production_count:
|
||||
logging.info("-----不等于----")
|
||||
logging.info(f"name: {item.name}")
|
||||
logging.info(
|
||||
f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
logging.info(f"deadline_of_delivery: {item.deadline_of_delivery}")
|
||||
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||
item.delivery_warning = 'warning'
|
||||
elif today == item.deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
elif today >= item.deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
item.delivery_warning = 'overdue'
|
||||
elif production_done_count == item.mrp_production_count:
|
||||
logging.info("-----等于----")
|
||||
logging.info(f"name: {item.name}")
|
||||
logging.info(
|
||||
f"production_not_done: {len(production_not_done)}, production_done_count: {production_done_count}")
|
||||
logging.info(f"deadline_of_delivery: {item.deadline_of_delivery}")
|
||||
if item.delivery_status in ['pending', 'partial']:
|
||||
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||
item.delivery_warning = 'warning'
|
||||
elif today == item.deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
elif today >= item.deadline_of_delivery and item.delivery_warning not in ['overdue']:
|
||||
item.delivery_warning = 'overdue'
|
||||
else:
|
||||
logging.info("-----1111111----")
|
||||
continue
|
||||
# 获取业务节点
|
||||
business_node_ids = {
|
||||
|
||||
Reference in New Issue
Block a user