Accept Merge Request #1898: (feature/tool_standard_library_process -> develop)

Merge Request: 同一个销售订单的不同产品的坯料获取方式不一样,生成的采购订单问题

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1898
This commit is contained in:
廖丹龙
2025-03-13 10:12:56 +08:00
committed by Coding
2 changed files with 16 additions and 7 deletions

View File

@@ -1574,7 +1574,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

@@ -1198,11 +1198,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):
@@ -1289,7 +1285,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):
# 判断工单状态是否为等待组件