[web2py] Re: compute field doesn't work on update

2013-02-06 Thread palomar
up Il giorno sabato 19 gennaio 2013 18:43:51 UTC+1, palomar ha scritto: > > I had the 2.1 and I've just updated to 2.3 (I hoped to solve the > problem...) > > request.vars.id is the vars from the ajax call; it works, I'm sure, > articolo.p_p is correctly updated > > Il giorno sabato 19 gennaio

[web2py] Re: compute field doesn't work on update

2013-01-19 Thread palomar
I had the 2.1 and I've just updated to 2.3 (I hoped to solve the problem...) request.vars.id is the vars from the ajax call; it works, I'm sure, articolo.p_p is correctly updated Il giorno sabato 19 gennaio 2013 18:03:34 UTC+1, palomar ha scritto: > > Other users have the same problem and, sorr

[web2py] Re: compute field doesn't work on update

2013-01-19 Thread Massimo Di Pierro
Works for me: >>> db =DAL() >>> db.define_table('magazzino', ... Field('id_tipo', 'integer',default=0), ... Field('p_p','double', default=0.0), ... Field('pp_tot','double', writable=True, readable=True, compute=lambda r: r['id_tipo']==0 and r['p_p']*1 or r['p_p']*r['id_tipo']*-1), ..