Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -791,11 +791,11 @@ class MrpProduction(models.Model):
|
||||
self.ensure_one()
|
||||
iot_code = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
|
||||
'ir.sequence'].next_by_code('stock.lot.serial')
|
||||
iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code)
|
||||
# iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code)
|
||||
self.lot_producing_id = self.env['stock.lot'].create({
|
||||
'product_id': self.product_id.id,
|
||||
'company_id': self.company_id.id,
|
||||
'name': iot_code_name,
|
||||
'name': iot_code,
|
||||
})
|
||||
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
||||
self.move_finished_ids.filtered(
|
||||
|
||||
@@ -103,7 +103,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
record.back_button_display = True
|
||||
else:
|
||||
record.back_button_display = False
|
||||
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹':
|
||||
# tag_type
|
||||
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹' or any(
|
||||
detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工'
|
||||
for detection_result in cur_workorder.production_id.detection_result_ids
|
||||
):
|
||||
record.back_button_display = False
|
||||
else:
|
||||
next_workorder = sorted_workorders[position + 1]
|
||||
@@ -113,7 +117,10 @@ class ResMrpWorkOrder(models.Model):
|
||||
record.back_button_display = True
|
||||
else:
|
||||
record.back_button_display = False
|
||||
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹':
|
||||
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹' or any(
|
||||
detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工'
|
||||
for detection_result in cur_workorder.production_id.detection_result_ids
|
||||
):
|
||||
record.back_button_display = False
|
||||
|
||||
date_planned_start = fields.Datetime(tracking=True)
|
||||
@@ -1513,7 +1520,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
# ('state', '!=', 'done')])
|
||||
# if raw_move:
|
||||
# raw_move.write({'state': 'done'})
|
||||
record.production_id.button_mark_done1()
|
||||
if record.production_id.state != 'rework':
|
||||
record.production_id.button_mark_done1()
|
||||
# record.production_id.state = 'done'
|
||||
|
||||
# ============工单完成,修改对应[质检单]的值=====================
|
||||
|
||||
@@ -455,7 +455,8 @@ class ProductionLot(models.Model):
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', product.name)],
|
||||
limit=1, order='name desc')
|
||||
move_line_id = self.env['stock.move.line'].sudo().search(
|
||||
[('product_id', '=', product.id), ('lot_name', 'ilike', product.name)], limit=1, order='lot_name desc')
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id), ('lot_name', 'ilike', product.name)],
|
||||
limit=1, order='lot_name desc')
|
||||
if last_serial or move_line_id:
|
||||
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name if (
|
||||
not move_line_id or
|
||||
@@ -645,6 +646,16 @@ class StockPicking(models.Model):
|
||||
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
|
||||
if sale_id and not stock_picking:
|
||||
sale_id.write({'state': 'delivered'})
|
||||
if self.location_dest_id.name == '成品存货区' and self.state == 'done':
|
||||
for move in self.move_ids:
|
||||
for production in self.sale_order_id.mrp_production_ids:
|
||||
moves = self.env['stock.move'].search([
|
||||
('name', '=', production.name),
|
||||
('state', '!=', 'cancel')
|
||||
])
|
||||
finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None)
|
||||
if finish_move.id in move.move_orig_ids.ids and finish_move.state == 'done':
|
||||
production.workorder_ids.write({'back_button_display': False})
|
||||
return res
|
||||
|
||||
# 创建 外协出库入单
|
||||
@@ -713,20 +724,6 @@ class StockPicking(models.Model):
|
||||
'draft', 'sent']:
|
||||
picking.state = 'waiting'
|
||||
|
||||
# def write(self, vals):
|
||||
#
|
||||
# old_state = None
|
||||
# if 'state' in vals:
|
||||
# old_state = self.state
|
||||
# res = super(StockPicking, self).write(vals)
|
||||
# if (self.picking_type_id.use_existing_lots is False and self.picking_type_id.use_create_lots is True and
|
||||
# (('move_ids_without_package' in vals and self.state == 'assigned')
|
||||
# or ('state' in vals and vals['state'] == 'assigned' and old_state not in ['assigned', 'done']))):
|
||||
# if self.move_ids_without_package:
|
||||
# for move_id in self.move_ids_without_package:
|
||||
# move_id.action_show_details()
|
||||
# return res
|
||||
|
||||
@api.constrains('state', 'move_ids_without_package')
|
||||
def _check_move_ids_without_package(self):
|
||||
"""
|
||||
@@ -913,8 +910,8 @@ class ReStockMove(models.Model):
|
||||
lot_code = '%s-%s-%s' % ('%s-T-DJWL-%s' % (
|
||||
product.cutting_tool_model_id.code.split('-')[0], product.cutting_tool_material_id.code),
|
||||
datetime.now().strftime("%Y%m%d"), origin)
|
||||
move_line_ids = self.env['stock.move.line'].sudo().search([('lot_name', 'like', lot_code)], limit=1,
|
||||
order='id desc')
|
||||
move_line_ids = self.env['stock.move.line'].sudo().search(
|
||||
[('company_id', '=', company.id), ('lot_name', 'like', lot_code)], limit=1, order='id desc')
|
||||
if not move_line_ids:
|
||||
lot_code = '%s-001' % lot_code
|
||||
else:
|
||||
@@ -951,7 +948,8 @@ class ReStockMove(models.Model):
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', origin)],
|
||||
limit=1, order='id DESC')
|
||||
move_line_id = self.env['stock.move.line'].sudo().search(
|
||||
[('product_id', '=', product.id), ('lot_name', 'ilike', origin)], limit=1, order='lot_name desc')
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id), ('lot_name', 'ilike', origin)],
|
||||
limit=1, order='lot_name desc')
|
||||
split_codes = product.cutting_tool_model_id.code.split('-')
|
||||
if last_serial or move_line_id:
|
||||
return "%s-T-%s-%s-%03d" % (
|
||||
@@ -1059,6 +1057,8 @@ class ReStockMove(models.Model):
|
||||
更新序列号 功能按钮
|
||||
"""
|
||||
self.move_line_nosuggest_ids.unlink()
|
||||
if self.state != 'assigned':
|
||||
self.state = 'assigned'
|
||||
return self.action_show_details()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user