Skip to Content
Menú
This question has been flagged
1 Respondre
3601 Vistes

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]

Avatar
Descartar
Best Answer

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

Avatar
Descartar

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>

Related Posts Respostes Vistes Activitat
3
d’abr. 25
4431
5
de nov. 23
42774
3
de set. 23
9349
1
de juny 22
12427
3
de març 20
10923