On 2016-06-17 13:57, Richard V. wrote:
> @classmethod
> def set_dats(cls, companies, name, value):
> for c in companies:
> if not type(c.dat) is dict:
> c.dat = {}
> if value:
> c.dat[name] = value
> elif name in c.dat:
> del c.dat[name]
Modification of the instances in the setter method are not saved by
default. So you have to call yourself the write method or save the
instances. I'm not sure if saving will not create a loop, I never did
such thing so it must be tested.
I have created issue5651 to clarify the behaviour:
https://bugs.tryton.org/issue5651
Also if you go with the save, changing in-place the dict will not be
detected as a change. You have to re-assign the dictionary. See
https://bugs.tryton.org/issue5652
--
Cédric Krier - B2CK SPRL
Email/Jabber:
cedric...@b2ck.com
Tel:
+32 472 54 46 59
Website:
http://www.b2ck.com/