Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to concatenate fields in a view?

on 1/22/15, 12:00 PM 1,193 views


I have 2 fields, Name and Lastname, but in the view I want them to appear together inside just one field, so instead of having:

<field name="Name" string="Name" />

<field name="Last Name" string="Last Name" />

I want 1 field which would have Name+Last Name

Any tip on how to do this will be appreciated,


@Yakito, if answer is good, you vote and/or accept this answer!

on 1/22/15, 2:31 PM

Yes yes, sure I will, I have to test it first. That will happen tonight!

on 1/22/15, 2:36 PM
Roberto Cocchiararo
On 1/22/15, 12:50 PM

You could try something like:

<label for="Name and Lastname"/>
     <field name="Name" class="oe_inline"/><field name="Last Name" class="oe_inline" />

The "label" should be the "string" that you wish to show.

Oh, perfect, I thought I had to do it on python, this is much simpler. thanks!

on 1/22/15, 1:06 PM

You can define a field and user a python code to concatenate what you want, but i thought that you only needed a "visual thing". If you need to store it for some reason i have a very basic example i had to make :P (i am a newbie myself :P)

Roberto Cocchiararo
on 1/22/15, 1:13 PM
On 4/11/16, 9:39 PM

Oi Federico,

Tray the code below. You may iterate the variables if there are a list in place of object's fields.

<t t-set="finaltext" t-value="obj.yourvariable1+' #'+obj.yourvariable2+', #'+obj.yourvariable3 "/>
<span t-esc="finaltext"/>
On 5/12/15, 5:56 PM

Is possible to do the same thing with strings from a a single field (in my case product.id from pos.order)? 

I would like to concatenate every code starting with '#' between the codes starting with [internal reference].

Normal view:

[0001] product1
# product instructions 1
# product instructions 2

[0002] product2
# product instructions 1
# product instructions 2

Should appear as :

[0001] product1    # product instructions 1 , # product instructions 2

[0002] product2    # product instructions 1 , # product instructions 2

Is it possible with the same principle directly on xml? I don't need to store information (for now) is just another rappresentation.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 1/22/15, 12:00 PM
Seen: 1193 times
Last updated: 4/11/16, 9:39 PM