Odoo Help


What is the correct syntax for an "if" request ?

Anne-Sylvie Burri
on 6/11/13, 6:49 AM 1,544 views

Hi everybody,

I'm trying to add an "if" request in my invoice report but I can't find the correct syntax.

I have companies and contacts (who are not linked to a company). I have a number (x_nocompany) for each company and a personal number (ref) for each contact.

What I want to do is if the invoice is for a company then the company number appear else if the invoice is for a contact then the contact number appear.

Now my code is the following :

[[ (o.partner_id.ref=='') and (o.partner_id.x_nocompany) or (o.partner_id.ref) ]]

Someone could help me ?

Many thanks in advance.



ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
| 6 5 8
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd.
On 6/11/13, 7:03 AM


try this

 [[ (o.partner_id.ref) or (o.partner_id.x_nocompany) or (o.partner_id.ref) ]]


It works perfectly! Thanks :)

J.-M. Burri - Bureau ing.-conseils informatique, Anne-Sylvie Burri
on 6/11/13, 7:17 AM
Juanjo Algaz
On 6/11/13, 7:25 AM


[[ o.partner_id.x_nocompany or o.partner_id.ref ]]

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 6/11/13, 6:49 AM
Seen: 1544 times
Last updated: 3/16/15, 8:10 AM