Odoo Help

Welcome!

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.

0

conditional text in report

By
M. Höppner
on 5/6/14, 7:27 AM 9,270 views

Hello,

in my invoice I would like to have a text / hint for the customer depending on the payment term.
If payment_term contains "prepaid" then print "You really have to pay before you get your item!"

How can I do this? I got the following working:
You really have to pay before you get your item! Please use the following number as reference: [[ ((o.payment_term.name == '100% Vorkasse') or removeParentNode('para')) and '' ]] [[ o.number ]]

But I would like to have "contains", not "==".

0
M. Höppner
On 5/6/14, 9:36 AM

[[ 'prepaid' in o.payment_term.name and 'You really have to pay before you get your item!' ]]

Operation Result
x in s True if an item of s is equal to x, else False

This table summarizes the comparison operations:

Operation Meaning Notes
< strictly less than  
<= less than or equal  
> strictly greater than  
>= greater than or equal  
== equal  
!= not equal (1)
is object identity  
is not negated object identity  
0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 5/6/14, 7:45 AM

Hi,

Try this code will help you

[[  payment_term == 'prepaid' and  "You really have to pay before you get your item!" ]]

I'm sorry - was not clear enough: I have 2 (or more) prepaid options: 100% prepaid, 50% prepaid/50% before shipment aso.), all contain the word "prepaid", that is the goal

M. Höppner
on 5/6/14, 8:13 AM

I did'n get you. can specify more ?

Jagdish Panchal
on 5/6/14, 8:26 AM

okay, I'll try: payment terms available: 100% prepaid, 50% prepaid, 25% prepaid, in 30 days, in 3 days, aso.

For each invoice with a condition containing "prepaid" I would like to add / highlight: "You really have to pay before you get your item! Please use the following ..."

M. Höppner
on 5/6/14, 8:28 AM

[[ payment_term == '100% prepaid' or payment_term == '50% prepaid' or payment_term == '100% prepaid' or payment_term == '25% prepaid' and "You really have to pay before you get your item!" ]] try this otherwise you can create method and do.

Jagdish Panchal
on 5/6/14, 8:39 AM

found a link to phyton types: https://docs.python.org/2/library/stdtypes.html#boolean-operations-and-or-not

so this seems to work - it's a bit simpler than to type each condition, could you test and confirm:

[[ 'prepaid' in o.payment_term.name and 'You really have to pay before you get your item!' ]]

M. Höppner
on 5/6/14, 8:45 AM

[[ 'prepaid' in o.payment_term.name and 'You really have to pay before you get your item!' ]] yes this will work.

Jagdish Panchal
on 5/6/14, 8:57 AM

thanks a lot

M. Höppner
on 5/6/14, 9:19 AM

Have you got solution ?

Jagdish Panchal
on 5/6/14, 9:23 AM

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

0 follower(s)

Stats

Asked: 5/6/14, 7:27 AM
Seen: 9270 times
Last updated: 3/16/15, 8:10 AM