Accept Merge Request #1943: (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/1943
This commit is contained in:
@@ -754,7 +754,7 @@ class ReStockMove(models.Model):
|
|||||||
if move.product_id.categ_id.type == '成品':
|
if move.product_id.categ_id.type == '成品':
|
||||||
move.part_number = move.product_id.part_number
|
move.part_number = move.product_id.part_number
|
||||||
move.part_name = move.product_id.part_name
|
move.part_name = move.product_id.part_name
|
||||||
elif move.product_id.categ_id.type == '坯料' or move.product_id.categ_id.type == '原材料':
|
elif move.product_id.categ_id.type == '坯料':
|
||||||
product_name = ''
|
product_name = ''
|
||||||
match = re.search(r'(S\d{5}-\d)', move.product_id.name)
|
match = re.search(r'(S\d{5}-\d)', move.product_id.name)
|
||||||
# 如果匹配成功,提取结果
|
# 如果匹配成功,提取结果
|
||||||
@@ -773,6 +773,34 @@ class ReStockMove(models.Model):
|
|||||||
lambda production: re.search(f'{product_name}$', production.product_id.name)
|
lambda production: re.search(f'{product_name}$', production.product_id.name)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if filtered_order_line:
|
||||||
|
move.part_number = filtered_order_line.part_number
|
||||||
|
move.part_name = filtered_order_line.part_name
|
||||||
|
elif move.product_id.categ_id.type == '原材料':
|
||||||
|
production_id = move.production_id or move.raw_material_production_id
|
||||||
|
if not production_id:
|
||||||
|
if not move.origin:
|
||||||
|
continue
|
||||||
|
production_id = self.env['mrp.production'].sudo().search(
|
||||||
|
[('name', '=', move.origin)],limit=1)
|
||||||
|
product_name = ''
|
||||||
|
match = re.search(r'(S\d{5}-\d)', production_id.product_id.name)
|
||||||
|
# 如果匹配成功,提取结果
|
||||||
|
if match:
|
||||||
|
product_name = match.group(0)
|
||||||
|
if move.picking_id.sale_order_id:
|
||||||
|
sale_order = move.picking_id.sale_order_id
|
||||||
|
else:
|
||||||
|
sale_order_name = ''
|
||||||
|
match = re.search(r'(S\d+)', production_id.product_id.name)
|
||||||
|
if match:
|
||||||
|
sale_order_name = match.group(0)
|
||||||
|
sale_order = self.env['sale.order'].sudo().search(
|
||||||
|
[('name', '=', sale_order_name)])
|
||||||
|
filtered_order_line = sale_order.order_line.filtered(
|
||||||
|
lambda production: re.search(f'{product_name}$', production.product_id.name)
|
||||||
|
)
|
||||||
|
|
||||||
if filtered_order_line:
|
if filtered_order_line:
|
||||||
move.part_number = filtered_order_line.part_number
|
move.part_number = filtered_order_line.part_number
|
||||||
move.part_name = filtered_order_line.part_name
|
move.part_name = filtered_order_line.part_name
|
||||||
|
|||||||
Reference in New Issue
Block a user