交期状态修改

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

@@ -35,23 +35,18 @@ class MrpProduction(models.Model):
tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True) tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True)
def _compute_default_delivery_status(self): def _compute_default_delivery_status(self):
need_list = [
'pending_cam',
'progress',
'rework',
'scrap',
'to_close',
]
try: try:
if self.state not in need_list: if self.state == 'cancel':
return False return False
if not self.deadline_of_delivery: if not self.deadline_of_delivery:
return '已逾期' return False
hours = self.get_hours_diff() hours = self.get_hours_diff()
if hours >= 48: if hours >= 48:
return '正常' return '正常'
elif hours > 0 and hours < 48: elif hours > 0 and hours < 48 and self.state != 'done':
return '预警' return '预警'
elif hours > 0 and hours < 48 and self.state == 'done':
return '正常'
else: else:
return '已逾期' return '已逾期'
except Exception as e: except Exception as e:
@@ -97,6 +92,9 @@ class MrpProduction(models.Model):
def _corn_update_delivery_status(self): def _corn_update_delivery_status(self):
need_list = [ need_list = [
'draft',
'technology_to_confirmed',
'confirmed',
'pending_cam', 'pending_cam',
'progress', 'progress',
'rework', 'rework',

View File

@@ -148,19 +148,19 @@ class ResMrpWorkOrder(models.Model):
tag_type = fields.Selection([("重新加工", "重新加工")], string="标签", tracking=True) tag_type = fields.Selection([("重新加工", "重新加工")], string="标签", tracking=True)
def _compute_default_construction_period_status(self): def _compute_default_construction_period_status(self):
need_list = [ need_list=['pending', 'waiting', 'ready', 'progress', 'to be detected','done']
'progress',
'to be detected']
try: try:
if self.state not in need_list: if self.state not in need_list:
return False return False
if not self.date_planned_finished: if not self.date_planned_finished:
return '已逾期' return False
hours = self.get_hours_diff() hours = self.get_hours_diff()
if hours >= 12: if hours >= 12:
return '正常' return '正常'
elif hours > 0 and hours < 12: elif hours > 0 and hours < 12 and self.state!='done':
return '预警' return '预警'
elif hours > 0 and hours < 12 and self.state=='done':
return '正常'
else: else:
return '已逾期' return '已逾期'
except Exception as e: except Exception as e:
@@ -205,9 +205,10 @@ class ResMrpWorkOrder(models.Model):
def run_compute_construction_period_status(self,records): def run_compute_construction_period_status(self,records):
records._compute_construction_period_status() records._compute_construction_period_status()
def _corn_update_construction_period_status(self): def _corn_update_construction_period_status(self):
need_list = [ need_list=['pending', 'waiting', 'ready', 'progress', 'to be detected']
'progress', # need_list = [
'to be detected'] # 'progress',
# 'to be detected']
self.get_page_all_records('mrp.workorder',self.run_compute_construction_period_status,[('state', 'in', need_list)],100) self.get_page_all_records('mrp.workorder',self.run_compute_construction_period_status,[('state', 'in', need_list)],100)
def get_hours_diff(self): def get_hours_diff(self):

View File

@@ -557,7 +557,7 @@
<separator/> <separator/>
</xpath> </xpath>
<xpath expr="//search" position="inside"> <xpath expr="//search" position="inside">
<searchpanel class="account_root"> <searchpanel>
<field name="state" icon="fa-filter" enable_counters="1"/> <field name="state" icon="fa-filter" enable_counters="1"/>
<field name="delivery_status" icon="fa-filter" enable_counters="1"/> <field name="delivery_status" icon="fa-filter" enable_counters="1"/>
</searchpanel> </searchpanel>