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

is there any way to put two fields inside the same column in the tree view in  odoo  15?
|           Columns              |

|Field1    Field2             |

the two fields are different [type]

頭像
捨棄
最佳答案

Hi Rguibi,

You can create a computing field and compute the value from the other fields two fields and display the value in this.

Please check code in comment. 

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

頭像
捨棄

Check the below example:

class Product(models.Model):
_name = 'product.product'

name = fields.Char()
price = fields.Char()

prod_name = fields.Char(compute="_compute_product_name", string="Product Name")

def _compute_product_name(self):
for rec in self:
rec.prod_name = rec.name + " " + rec.price

In tree view you can add a field like this:

<tree>
<field name="prod_name" />
</tree>

相關帖文 回覆 瀏覽次數 活動
3
4月 25
4377
5
11月 23
42715
3
9月 23
9304
1
6月 22
12367
3
3月 20
10879