diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 5f479969..031515a5 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -35,23 +35,18 @@ class MrpProduction(models.Model):
tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True)
def _compute_default_delivery_status(self):
- need_list = [
- 'pending_cam',
- 'progress',
- 'rework',
- 'scrap',
- 'to_close',
- ]
try:
- if self.state not in need_list:
+ if self.state == 'cancel':
return False
if not self.deadline_of_delivery:
- return '已逾期'
+ return False
hours = self.get_hours_diff()
if hours >= 48:
return '正常'
- elif hours > 0 and hours < 48:
+ elif hours > 0 and hours < 48 and self.state != 'done':
return '预警'
+ elif hours > 0 and hours < 48 and self.state == 'done':
+ return '正常'
else:
return '已逾期'
except Exception as e:
@@ -97,6 +92,9 @@ class MrpProduction(models.Model):
def _corn_update_delivery_status(self):
need_list = [
+ 'draft',
+ 'technology_to_confirmed',
+ 'confirmed',
'pending_cam',
'progress',
'rework',
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 19c28352..a61b0986 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -148,19 +148,19 @@ class ResMrpWorkOrder(models.Model):
tag_type = fields.Selection([("重新加工", "重新加工")], string="标签", tracking=True)
def _compute_default_construction_period_status(self):
- need_list = [
- 'progress',
- 'to be detected']
+ need_list=['pending', 'waiting', 'ready', 'progress', 'to be detected','done']
try:
if self.state not in need_list:
return False
if not self.date_planned_finished:
- return '已逾期'
+ return False
hours = self.get_hours_diff()
if hours >= 12:
return '正常'
- elif hours > 0 and hours < 12:
+ elif hours > 0 and hours < 12 and self.state!='done':
return '预警'
+ elif hours > 0 and hours < 12 and self.state=='done':
+ return '正常'
else:
return '已逾期'
except Exception as e:
@@ -205,9 +205,10 @@ class ResMrpWorkOrder(models.Model):
def run_compute_construction_period_status(self,records):
records._compute_construction_period_status()
def _corn_update_construction_period_status(self):
- need_list = [
- 'progress',
- 'to be detected']
+ need_list=['pending', 'waiting', 'ready', 'progress', 'to be detected']
+ # need_list = [
+ # 'progress',
+ # 'to be detected']
self.get_page_all_records('mrp.workorder',self.run_compute_construction_period_status,[('state', 'in', need_list)],100)
def get_hours_diff(self):
diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml
index c218c2d5..c56f4c3e 100644
--- a/sf_manufacturing/views/mrp_production_addional_change.xml
+++ b/sf_manufacturing/views/mrp_production_addional_change.xml
@@ -557,7 +557,7 @@
-
+