This question has been flagged
2 Replies
12595 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 "==".

Avatar
Discard
Author Best Answer

[[ '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  
Avatar
Discard
Best Answer

Hi,

Try this code will help you

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

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

I did'n get you. can specify more ?

Author

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 ..."

[[ 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.

Author

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!' ]]

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

Author

thanks a lot

Have you got solution ?