交期状态修改

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)
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',

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

View File

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