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, sorry but I can't find my solution;
> i tried with readable=true and writable=true, to update all the field
> interested in the compute function, to comment the line in DAL.py, but
> nothing.
>
> I have this table:
> 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),
> )
>
> If I edit a row with a FORM the compute field works but if I edit it in a
> function with ajax don't...
>
> def modArtPrice():
> newPp = 100
> articolo = db.magazzino[request.vars.id]
> articolo.id_tipo=articolo.id_tipo
> articolo.p_p=newPp
> articolo.update_record()
>
> what's wrong?
> s.
>
--