On Monday, July 13, 2015 at 1:38:11 PM UTC+2, raimonesteve wrote: > > 2015-07-13 13:21 GMT+02:00 Cédric Krier <[email protected] <javascript:>>: > > > On 2015-07-13 03:41, E. Boer wrote: > >> What I did was to make the PYSON-statement and then used the > PYSON-encoder > >> to encode it into some JSON and add that in the condition field. > > > > Yes we are still missing a text/char widget on the client side to > > encode/decode PYSON statement. > > ok. > > But without widget, an example about condition trigger? > > I try and I get error: > > Eval('self').get('name') == 'Bar' > > Also I debug env content and self in env is a empty dict when > EvalEnvironment(record, record.__class__) > > record: party.party,2 > record class: <class 'trytond.pool.party.party'> > > env values: > > {'current_date': datetime.datetime(2015, 7, 13, 11, 35, 37, 391614), > 'self': {}, 'context': {'date_format': '%d/%m/%Y', 'language': > 'ca_ES', 'locale': {'date': '%d/%m/%Y', 'thousands_sep': ' ', > 'decimal_point': ',', 'grouping': [3, 3, 0]}, 'language_direction': > 'ltr', '_check_access': True, 'company.rec_name': 'zz', 'groups': [1, > 5, 2, 9, 3, 7, 6, 4, 8], 'employee': None, 'company': 1}, 'time': > <module 'time' (built-in)>} > > As a trigger-condition I use {"s": [{"e":"false","s2": "10","s1": {"d": "","k": "value","__class__": "Get","v": {"d": {},"__class__": "Eval","v": "self"}},"__class__": "Greater"},{"e":"false","s2": "150","s1":{"d": "","k": "value","__class__": "Get","v": {"d": {},"__class__": "Eval","v": "self"}},"__class__": "Less"}],"__class__": "Or"}
You can use PYSONdecode to get PYSON-code back. From what I see is: - the value should between 10 and 150, - e = false, so it's only > and < (if e was true it will become >= and <= )
