Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3748 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer

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>

Gerelateerde posts Antwoorden Weergaven Activiteit
3
apr. 25
4682
5
nov. 23
43004
3
sep. 23
9480
1
jun. 22
12569
3
mrt. 20
11032