表面工艺添加零件图号零件名称
This commit is contained in:
@@ -117,6 +117,8 @@ class PurchaseOrderLine(models.Model):
|
||||
@api.depends('product_id')
|
||||
def _compute_related_product(self):
|
||||
for record in self:
|
||||
if record.part_number or record.part_name:
|
||||
continue
|
||||
if record.product_id.categ_id.name == '坯料':
|
||||
product_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_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:
|
||||
record.part_number = record.product_id.part_number
|
||||
record.part_name = record.product_id.part_name
|
||||
|
||||
@@ -374,6 +374,8 @@ class RePurchaseOrder(models.Model):
|
||||
'product_qty': 1,
|
||||
'product_uom': server_template.uom_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
|
||||
|
||||
Reference in New Issue
Block a user