Re: [tryton-dev] Help on Pyson Statement

2017-11-24 Thread Maxime Richez

> > I will create an issue in order to fix it.
> Done: https://bugs.tryton.org/issue6964
> 
> It will be great if you can test it :)
> 

Ok; tested ! Easier with the widget :-)

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/4b6c3c2c-d266-4d55-b651-7dfd225b86ee%40googlegroups.com.


Re: [tryton-dev] Help on Pyson Statement

2017-11-24 Thread Cédric Krier
On 2017-11-24 03:02, Maxime Richez wrote:
> Is there a tool in the gui to convert expression to Pyson ?

We have the pyson widget now. I think the condition field is missing it.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/20171124111753.GJ4148%40kei.


Re: [tryton-dev] Help on Pyson Statement

2017-11-24 Thread Sergi Almacellas Abellana

El 24/11/17 a les 12:09, Sergi Almacellas Abellana ha escrit:


I will create an issue in order to fix it.

Done: https://bugs.tryton.org/issue6964

It will be great if you can test it :)

--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

--
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/6702f829-a73f-3f3b-a7b3-0082fe94b1f0%40koolpi.com.


Re: [tryton-dev] Help on Pyson Statement

2017-11-24 Thread Sergi Almacellas Abellana

El 24/11/17 a les 12:02, Maxime Richez ha escrit:

You have some examples in the test suite:

http://hg.tryton.org/trytond/file/34073513c887/trytond/tests/test_modelview.py#l194

Have you tried?:

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

Hope it helps.

Thanks but we are testing from the tryton client, and expression is not a valid 
Pyson expression. Is there a way to convert your expression  in the gui client ?
We convert your expression with PYTHONEncoder and then we introduce the result 
in the GUI, and it's working whith this value:
{"s2": 500, "s1": {"d": 0, "k": "total_amount", "__class__": "Get", "v": {"d": {}, "__class__": "Eval", "v": 
"self"}}, "e": false, "__class__": "Greater"}

Is there a tool in the gui to convert expression to Pyson ?


Indeed there is a widget to manipulate the pyson statements on the 
tryton client [1]. You should be able to enter the pyson expresion on 
client and it will automatically encode the values when sending to the 
server.


But I see the widget is not activated for this field.

I will create an issue in order to fix it.

Thanks,

[1] https://bugs.tryton.org/issue4631

--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

--
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/0db91268-bd6e-2585-3737-0c0968510123%40koolpi.com.


Re: [tryton-dev] Help on Pyson Statement

2017-11-24 Thread Maxime Richez
> You have some examples in the test suite:
> 
> http://hg.tryton.org/trytond/file/34073513c887/trytond/tests/test_modelview.py#l194
> 
> Have you tried?:
> 
> Eval('self', {}).get('total_amount', 0) > 500
> 
> Hope it helps.

Thanks but we are testing from the tryton client, and expression is not a valid 
Pyson expression. Is there a way to convert your expression  in the gui client ?
We convert your expression with PYTHONEncoder and then we introduce the result 
in the GUI, and it's working whith this value:
{"s2": 500, "s1": {"d": 0, "k": "total_amount", "__class__": "Get", "v": {"d": 
{}, "__class__": "Eval", "v": "self"}}, "e": false, "__class__": "Greater"}

Is there a tool in the gui to convert expression to Pyson ?


-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/658b2066-7dde-4cee-a835-db279ca87291%40googlegroups.com.


Re: [tryton-dev] Help on Pyson Statement

2017-11-24 Thread Sergi Almacellas Abellana

El 24/11/17 a les 11:15, Maxime Richez ha escrit:

Hi,

We are looking to define a specific rule on a button (Models-> Models Access -> 
Buttons). Rule would be : 2 users needs to validate button if amount is greater than 
a specific value.
We try this expression : [["total_amount", ">", 500]] > This is not working. 
What should be the correct expression ?

You have some examples in the test suite:

http://hg.tryton.org/trytond/file/34073513c887/trytond/tests/test_modelview.py#l194

Have you tried?:

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

Hope it helps.


--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

--
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/ed8ab58c-9215-e20b-8d66-f1160575b649%40koolpi.com.


[tryton-dev] Help on Pyson Statement

2017-11-24 Thread Maxime Richez
Hi,

We are looking to define a specific rule on a button (Models-> Models Access -> 
Buttons). Rule would be : 2 users needs to validate button if amount is greater 
than a specific value. 
We try this expression : [["total_amount", ">", 500]]
This is not working. What should be the correct expression ?
Thanks !

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/909fbdc8-1b40-4812-9b9a-d02aa76d5948%40googlegroups.com.