On Wednesday, August 21, 2013 11:47:15 AM UTC-5, Nicolas Évrard wrote: > > * Demoy Blake [2013-08-21 18:11 +0200]: > > >> >thank you for the advice, Hi Évrard how might I alter a specific party > >> >address without resulting to sql statements > >> > >> Due to the switch to the active record pattern it is now quite easy to > >> change the value of field: > >> > >> > >> http://hg.tryton.org/modules/sale_supply/file/5c867861be6e/sale.py#l29 > >> > > > > > >I am unable to obtain the specific instance of the class whose fields > >I wish to alter, examples offered utilized 'self' as the class > >instance but I need to find the instance(s) with a specified party . > > You can get the instance using 'search' eg: > > instance, = cls.search([('id', '=', 78)]) > > >below I tried using the garbage collector to obtain the specific > >class instance, without success. > > > > cls=pool.get('party.address') > > import gc > > for obj in gc.get_objects(): > > if isinstance(obj, cls): > > if obj.party==78: > > obj.street='Mystreet name' > > obj.save() > > Why is it a class method? > Can you give us a more complete example? > > >should this have been posted as a new question? > > No it's fine for me. > > -- > Nicolas Évrard > > B2CK SPRL > 4, rue de Rotterdam > 4000 Liège > Belgium > Tel: +32 472 54 46 59 > E-mail/Jabber: [email protected] <javascript:> > Website: http://www.b2ck.com/ >
thank you so much Évrard
