Define condition on button rule

Hi,

On the demo, I’m testing conditions on button rules (Administration/Models/Models Access/Buttons).

In my test, I’m adding a rule on ‘wait’ button in model ‘Purchase Requisition’.

For instance, if total_amount is more than 20.0, ‘wait’ button should be clicked by two different users.

If I’m just defining the rule without condition, it works.

Then I’m defining a condition (Pyson: (‘total_amount’, ‘>’, '20.0) ):

which strangely become ‘20’:

and when testing to click ‘wait’ on a purchase requisition with any amount, it counts click on button… I was expecting if the total amount was lower than 20.0 then I could go on… but button should clicked twice…

Is my Pyson condition incorrect ? Why is my condition becoming ‘20’ instead of (‘total_amount’, ‘>’, '20.0) ?

Thanks for help !

This condition is always True as it is a tuple.

The web client does not support tuple so I guess this is how Javascript interpret this syntax.

Of course 20 is always true.

You must use something like:

Greater(Eval('self', {}).get('total_amount'), 20)
1 Like

Working with:

Greater(Eval('self', {}).get('total_amount', 0), 20)

which become:

(Eval('self', {}).get('total_amount', 0) > 20)

Thanks Cédric !

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.