跳至内容
菜单
此问题已终结
2 回复
13690 查看

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

形象
丢弃
编写者 最佳答案

[[ '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  
形象
丢弃
最佳答案

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

I did'n get you. can specify more ?

编写者

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.

编写者

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.

编写者

thanks a lot

Have you got solution ?

相关帖文 回复 查看 活动
3
12月 23
4132
1
2月 25
891
0
10月 24
1745
0
8月 24
1570
0
1月 24
2055