Accept Merge Request #1901: (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/1901
This commit is contained in:
@@ -117,6 +117,8 @@ class PurchaseOrderLine(models.Model):
|
|||||||
@api.depends('product_id')
|
@api.depends('product_id')
|
||||||
def _compute_related_product(self):
|
def _compute_related_product(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
|
if record.part_number or record.part_name:
|
||||||
|
continue
|
||||||
if record.product_id.categ_id.name == '坯料':
|
if record.product_id.categ_id.name == '坯料':
|
||||||
product_name = ''
|
product_name = ''
|
||||||
match = re.search(r'(S\d{5}-\d)', record.product_id.name)
|
match = re.search(r'(S\d{5}-\d)', record.product_id.name)
|
||||||
@@ -135,6 +137,17 @@ class PurchaseOrderLine(models.Model):
|
|||||||
)
|
)
|
||||||
record.part_number = filtered_order_line.product_id.part_number if filtered_order_line else None
|
record.part_number = filtered_order_line.product_id.part_number if filtered_order_line else None
|
||||||
record.part_name = filtered_order_line.product_id.part_name if filtered_order_line else None
|
record.part_name = filtered_order_line.product_id.part_name if filtered_order_line else None
|
||||||
|
elif record.product_id.categ_id.name == '表面工艺':
|
||||||
|
domain = [('name', '=', self.production_id.name),
|
||||||
|
('purchase_type', '=', 'consignment')]
|
||||||
|
purchase_orders = self.env['purchase.order'].search(domain)
|
||||||
|
purchase_orders_id = self.env['purchase.order']
|
||||||
|
for po in purchase_orders:
|
||||||
|
for line in po.order_line:
|
||||||
|
if line.product_id.server_product_process_parameters_id == self.surface_technics_parameters_id:
|
||||||
|
if line.product_qty == 1:
|
||||||
|
purchase_orders_id = line.order_id
|
||||||
|
return purchase_orders_id
|
||||||
else:
|
else:
|
||||||
record.part_number = record.product_id.part_number
|
record.part_number = record.product_id.part_number
|
||||||
record.part_name = record.product_id.part_name
|
record.part_name = record.product_id.part_name
|
||||||
|
|||||||
@@ -374,6 +374,8 @@ class RePurchaseOrder(models.Model):
|
|||||||
'product_qty': 1,
|
'product_qty': 1,
|
||||||
'product_uom': server_template.uom_id.id,
|
'product_uom': server_template.uom_id.id,
|
||||||
'related_product': production.product_id.id,
|
'related_product': production.product_id.id,
|
||||||
|
'part_number': pp.part_number,
|
||||||
|
'part_name': pp.part_name,
|
||||||
}))
|
}))
|
||||||
# 获取服务商品最后一个供应商的采购员
|
# 获取服务商品最后一个供应商的采购员
|
||||||
purchase_user_id = server_template.seller_ids[-1].partner_id.purchase_user_id
|
purchase_user_id = server_template.seller_ids[-1].partner_id.purchase_user_id
|
||||||
|
|||||||
Reference in New Issue
Block a user