优化外协采购和出入库单(工艺退回调整)
This commit is contained in:
@@ -145,7 +145,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
tag_type = fields.Selection([("重新加工", "重新加工")], string="标签", tracking=True)
|
||||
|
||||
def _compute_default_construction_period_status(self):
|
||||
need_list=['pending', 'waiting', 'ready', 'progress', 'to be detected','done']
|
||||
need_list = ['pending', 'waiting', 'ready', 'progress', 'to be detected', 'done']
|
||||
try:
|
||||
if self.state not in need_list:
|
||||
return False
|
||||
@@ -154,9 +154,9 @@ class ResMrpWorkOrder(models.Model):
|
||||
hours = self.get_hours_diff()
|
||||
if hours >= 12:
|
||||
return '正常'
|
||||
elif hours > 0 and hours < 12 and self.state!='done':
|
||||
elif hours > 0 and hours < 12 and self.state != 'done':
|
||||
return '预警'
|
||||
elif hours > 0 and hours < 12 and self.state=='done':
|
||||
elif hours > 0 and hours < 12 and self.state == 'done':
|
||||
return '正常'
|
||||
else:
|
||||
return '已逾期'
|
||||
@@ -168,7 +168,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
def _compute_construction_period_status(self):
|
||||
for worker in self:
|
||||
construction_period_status = worker._compute_default_construction_period_status()
|
||||
if construction_period_status and worker.construction_period_status!=construction_period_status:
|
||||
if construction_period_status and worker.construction_period_status != construction_period_status:
|
||||
worker.construction_period_status = construction_period_status
|
||||
|
||||
construction_period_status = fields.Selection([('正常', '正常'), ('预警', '预警'), ('已逾期', '已逾期')],
|
||||
@@ -199,14 +199,17 @@ class ResMrpWorkOrder(models.Model):
|
||||
func(records)
|
||||
# 增加页码
|
||||
page_number += 1
|
||||
def run_compute_construction_period_status(self,records):
|
||||
|
||||
def run_compute_construction_period_status(self, records):
|
||||
records._compute_construction_period_status()
|
||||
|
||||
def _corn_update_construction_period_status(self):
|
||||
need_list=['pending', 'waiting', 'ready', '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)
|
||||
self.get_page_all_records('mrp.workorder', self.run_compute_construction_period_status,
|
||||
[('state', 'in', need_list)], 100)
|
||||
|
||||
def get_hours_diff(self):
|
||||
# 获取当前日期和时间
|
||||
@@ -230,16 +233,16 @@ class ResMrpWorkOrder(models.Model):
|
||||
def _compute_surface_technics_picking_ids(self):
|
||||
for workorder in self:
|
||||
if workorder.routing_type == '表面工艺':
|
||||
domain = [('origin', '=', workorder.production_id.name), ('state', 'not in', ['cancel'])]
|
||||
domain = [('origin', '=', workorder.production_id.name), ('state', 'not in', ['cancel']),
|
||||
('partner_id', '!=', False)]
|
||||
previous_workorder = self.env['mrp.workorder'].search(
|
||||
[('sequence', '=', workorder.sequence - 1), ('routing_type', '=', '表面工艺'),
|
||||
('production_id', '=', workorder.production_id.id)])
|
||||
if previous_workorder:
|
||||
process_product = self.env['product.template']._get_process_parameters_product(
|
||||
previous_workorder.surface_technics_parameters_id)
|
||||
domain += [('partner_id', '=', process_product.partner_id.id)]
|
||||
else:
|
||||
domain += [('surface_technics_parameters_id', '=', workorder.surface_technics_parameters_id.id)]
|
||||
if previous_workorder.supplier_id != workorder.supplier_id:
|
||||
process_product = self.env['product.template']._get_process_parameters_product(
|
||||
previous_workorder.surface_technics_parameters_id)
|
||||
domain += [('partner_id', '=', process_product.partner_id.id)]
|
||||
picking_ids = self.env['stock.picking'].search(domain, order='id asc')
|
||||
workorder.surface_technics_picking_count = len(picking_ids)
|
||||
workorder.picking_ids = picking_ids.ids
|
||||
|
||||
Reference in New Issue
Block a user