还原代码
This commit is contained in:
@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError
|
|||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|
||||||
|
|
||||||
# from OCC.Extend.DataExchange import read_step_file
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
# from OCC.Extend.DataExchange import write_stl_file
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ class SFMessageMaintenanceLogs(models.Model):
|
|||||||
_name = 'sf.maintenance.logs'
|
_name = 'sf.maintenance.logs'
|
||||||
_inherit = ['sf.maintenance.logs', 'jikimo.message.dispatch']
|
_inherit = ['sf.maintenance.logs', 'jikimo.message.dispatch']
|
||||||
|
|
||||||
# @api._model_create_multi
|
@api._model_create_multi
|
||||||
# def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
# res = super(SFMessageMaintenanceLogs, self).create(vals_list)
|
res = super(SFMessageMaintenanceLogs, self).create(vals_list)
|
||||||
# for rec in res:
|
for rec in res:
|
||||||
# rec.add_queue()
|
rec.add_queue()
|
||||||
# return res
|
return res
|
||||||
|
|
||||||
def _get_message(self, message_queue_ids):
|
def _get_message(self, message_queue_ids):
|
||||||
contents = super(SFMessageMaintenanceLogs, self)._get_message(message_queue_ids)
|
contents = super(SFMessageMaintenanceLogs, self)._get_message(message_queue_ids)
|
||||||
|
|||||||
@@ -103,23 +103,35 @@ class SFMessageSale(models.Model):
|
|||||||
today = datetime.today().date()
|
today = datetime.today().date()
|
||||||
deadline_check = today + timedelta(days=1)
|
deadline_check = today + timedelta(days=1)
|
||||||
logging.info(f"today: {today}, deadline_check: {deadline_check}")
|
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:
|
for item in sale_order:
|
||||||
production = self.env['mrp.production'].search([('origin', '=', item.name)])
|
production = self.env['mrp.production'].search([('origin', '=', item.name)])
|
||||||
production_not_done = production.filtered(lambda p: p.state not in ['done', 'scrap', 'cancel'])
|
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']))
|
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']:
|
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||||
item.delivery_warning = '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'
|
item.delivery_warning = 'overdue'
|
||||||
elif production_done_count == item.mrp_production_count:
|
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 item.delivery_status in ['pending', 'partial']:
|
||||||
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
if deadline_check == item.deadline_of_delivery and item.delivery_warning not in ['warning']:
|
||||||
item.delivery_warning = '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'
|
item.delivery_warning = 'overdue'
|
||||||
else:
|
else:
|
||||||
|
logging.info("-----1111111----")
|
||||||
continue
|
continue
|
||||||
# 获取业务节点
|
# 获取业务节点
|
||||||
business_node_ids = {
|
business_node_ids = {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from datetime import datetime
|
|||||||
import requests
|
import requests
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
# from OCC.Extend.DataExchange import read_step_file
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
# from OCC.Extend.DataExchange import write_stl_file
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from stl import mesh
|
from stl import mesh
|
||||||
# from OCC.Core.GProp import GProp_GProps
|
# from OCC.Core.GProp import GProp_GProps
|
||||||
# from OCC.Extend.DataExchange import read_step_file
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
# from OCC.Extend.DataExchange import write_stl_file
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|||||||
Reference in New Issue
Block a user