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

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

相關帖文 回覆 瀏覽次數 活動
2
4月 23
8524
3
9月 20
4459
2
4月 20
6219
2
9月 19
5119
2
2月 18
7870