Merge branch 'develop' into feature/commercially_launched

This commit is contained in:
胡尧
2025-03-13 11:34:17 +08:00
5 changed files with 21 additions and 9 deletions

View File

@@ -1577,7 +1577,7 @@ class MrpProduction(models.Model):
vals['picking_type_id'] = picking_type_id
vals['name'] = self.env['stock.picking.type'].browse(picking_type_id).sequence_id.next_by_id()
product_id = self.env['product.product'].browse(vals['product_id'])
is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工'
is_self_process = product_id.materials_type_id.gain_way if product_id.materials_type_id else None
is_customer_provided = product_id.is_customer_provided
key = f"{is_self_process}_{is_customer_provided}"
if not is_custemer_group_id.get(key):

View File

@@ -1199,11 +1199,7 @@ class ResMrpWorkOrder(models.Model):
'cmm_ids': production.workorder_ids.filtered(lambda t: t.routing_type == 'CNC加工').cmm_ids,
}]
return workorders_values_str
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state',
'production_id.tool_state', 'production_id.schedule_state', 'sequence',
'production_id.programming_state')
def _compute_state(self):
def _process_compute_state(self):
for workorder in self:
# 如果工单的工序没有进行排序则跳出循环
if workorder.production_id.workorder_ids.filtered(lambda wk: wk.sequence == 0):
@@ -1290,7 +1286,20 @@ class ResMrpWorkOrder(models.Model):
mo.get_move_line(workorder.production_id, workorder))
else:
workorder.state = 'waiting'
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state',
'production_id.tool_state', 'production_id.schedule_state', 'sequence',
'production_id.programming_state')
def _compute_state(self):
self._process_compute_state()
for workorder in self:
if workorder.state == 'waiting' or workorder.state == 'pending':
for check_id in workorder.check_ids:
if not check_id.is_inspect:
check_id.quality_state = 'waiting'
if workorder.state == 'ready':
for check_id in workorder.check_ids:
if not check_id.is_inspect:
check_id.quality_state = 'none'
# 重写工单开始按钮方法
def button_start(self):
# 判断工单状态是否为等待组件

View File

@@ -1032,6 +1032,8 @@ class ReStockMove(models.Model):
productions = self.env['mrp.production'].search(
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
res['origin'] = ','.join(productions.mapped('name'))
if self.picking_type_id.name == '客供料入库':
self.picking_id.sudo().write({'origin': res['origin'] if res.get('origin') else self[0].picking_id.origin})
return res
def _get_new_picking_values(self):