Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3245 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona

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>

Post correlati Risposte Visualizzazioni Attività
3
apr 25
3867
5
nov 23
42157
3
set 23
8943
1
giu 22
12043
3
mar 20
10607