交期状态修改

This commit is contained in:
liaodanlong
2024-11-15 10:33:47 +08:00
parent 9a9bfd198b
commit 811a79c7c1
3 changed files with 18 additions and 19 deletions

View File

@@ -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):