A Divendres, 15 de gener de 2010, Cloves Almeida va escriure:
> I didn't test it, but maybe adding the code below to stock.py:276 should 
> do the trick.
> 
> cr.execute("select id from stock_move where location_dest_id=%s and 
> location_id<>%s and product_id=%s and state='done' FOR UPDATE", (id, id, 
> product_id));
> cr.execute("select id from stock_move where location_id=%s and 
> location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') 
> FOR UPDATE", (id, id, product_id))
> 

That was my first thought but it doesn't work because the WHERE clause states 
that the query will only select (and thus block for update) those records in 
'done' or 'assigned' state.

We'd need another query only to do the SELECT FOR UPDATE, and I eventually 
decided I'd better use the LOCK, to avoid too many sequential scans on the 
table. I'm not sure which option would be better from a performance point of 
view but I've posted a bug report in launchpad with the fix.

-- 
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community-leaders
Post to     : openerp-community-leaders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-leaders
More help   : https://help.launchpad.net/ListHelp

Reply via email to