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

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]

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

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

Ảnh đại diện
Huỷ bỏ

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>

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 4 25
4456
5
thg 11 23
42807
3
thg 9 23
9375
1
thg 6 22
12450
3
thg 3 20
10947