Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6347 Lượt xem

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.?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks Mahmoud

Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks Linto

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 17
4222
2
thg 8 23
4402
0
thg 10 21
1818
1
thg 9 19
5343
1
thg 6 25
926