跳至內容
選單
此問題已被標幟
2 回覆
6307 瀏覽次數

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

相關帖文 回覆 瀏覽次數 活動
1
5月 17
4191
2
8月 23
4321
0
10月 21
1784
1
9月 19
5255
1
6月 25
857