Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6354 มุมมอง

I have a custom field in product.template. I want to pass that value to product.product.

Normally product type, internal reference are passed to product.product

1.How is that work in base code?

2.How to my custom field to product.product.?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Product.product is inherits from product.template, so any filed in product.template will automatically passed to product.product by framework

2- So to custom field in product.product you can inherit product.product or product.template and add your new field

อวตาร
ละทิ้ง
ผู้เขียน

Thanks Mahmoud

คำตอบที่ดีที่สุด

If you need to access a custom field value of product.template, from product.product, you can do it easily.
Just browse the product.product record and use the product_tmpl_id field to get the custom field value from product.template table. i.e, like,

for product in self.env['product.product'].search([]):
     print "custom_field value =', product.product_tmpl_id.custom_field
อวตาร
ละทิ้ง
ผู้เขียน

Thanks Linto

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 17
4223
2
ส.ค. 23
4427
0
ต.ค. 21
1818
1
ก.ย. 19
5352
1
มิ.ย. 25
931