Improve stock compute

bzr revid: ced-7bf3c1dc298b8b41991c365c8b028d7efcc963b8
This commit is contained in:
ced 2007-09-13 14:22:08 +00:00
parent faac1d8aee
commit 0fe0abc9de
1 changed files with 12 additions and 0 deletions

View File

@ -680,6 +680,18 @@ class stock_move(osv.osv):
'date_planned': lambda *a: time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
def _auto_init(self, cursor):
super(stock_move, self)._auto_init(cursor)
cursor.execute('SELECT indexname \
FROM pg_indexes \
WHERE indexname = \'stock_move_location_id_location_dest_id_product_id_state\'')
if not cursor.fetchone():
cursor.execute('CREATE INDEX stock_move_location_id_location_dest_id_product_id_state \
ON stock_move (location_id, location_dest_id, product_id, state)')
cursor.commit()
def onchange_product_id(self, cr, uid, context, prod_id=False, loc_id=False, loc_dest_id=False):
if not prod_id:
return {}