Accept Merge Request #1732: (feature/customer_supply -> 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/1732
This commit is contained in:
廖丹龙
2025-01-13 13:03:40 +08:00
committed by Coding
2 changed files with 12 additions and 10 deletions

View File

@@ -93,15 +93,16 @@ class PurchaseOrder(models.Model):
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
related_product = fields.Many2one('product.product', compute='_compute_related_product', string='关联产品',
related_product = fields.Many2one('product.product', string='关联产品',
help='经此产品工艺加工成的成品')
@api.depends('order_id.origin')
def _compute_related_product(self):
for record in self:
if record.product_id.detailed_type:
production_id = self.env['mrp.production'].search([('name', '=', record.order_id.origin)])
record.related_product = production_id.product_id if production_id else False
else:
record.related_product = False
# @api.depends('order_id.origin')
# def _compute_related_product(self):
# for record in self:
# if record.product_id.detailed_type:
# production_id = self.env['mrp.production'].search([('name', '=', record.order_id.origin)])
# record.related_product = production_id.product_id if production_id else False
# else:
# record.related_product = False

View File

@@ -355,7 +355,8 @@ class RePurchaseOrder(models.Model):
server_product_process.append((0, 0, {
'product_id': server_template.product_variant_id.id,
'product_qty': 1,
'product_uom': server_template.uom_id.id
'product_uom': server_template.uom_id.id,
'related_product': production.product_id.id,
}))
# 获取服务商品最后一个供应商的采购员
purchase_user_id = server_template.seller_ids[-1].partner_id.purchase_user_id