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

i need to access the default code in the table product_product (i need to use this field since the product is a variant)but i dont know how to do it

i already tried

 l.product_id.product_product_tmpl_id.default_code

but it gives an empty result while their is value in the actual table

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

sorry its l.product_id.product_tmpl_id.default_code

still when i show a date or id or any other value from the same table it woks except for default_code

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

You should try the following code:

<span t-field="l.product_id.default_code"/>

If product has default code, it will display.


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

the thing is the product is a variant so their is no default code for the product in the table product_template while the value exist for the variant in the product_product table and thats the value i want to get and show in my report

product.product (variant) inherits product.template and because of that you can access all the fields of product.template in product.product

ผู้เขียน

i know ,but like i said i cant access the default_code value in product_product and thats what im asking on how to do it

ผู้เขียน

no, just showing an emty result but i checked the table and the value is their

ผู้เขียน

the answer is l.product_id.code even if the fields name in the db is default_code

Related Posts ตอบกลับ มุมมอง กิจกรรม
t-att-href url get error แก้ไขแล้ว
2
เม.ย. 23
8543
3
ก.ย. 20
4472
2
เม.ย. 20
6237
2
ก.ย. 19
5136
2
ก.พ. 18
7880