[FIX] We can't manually create a 'receipt product' because the create_date field is passed by the web client. workaround: just redefine the create and remove the 'create_date' field from the values: TOFIX in the orm

bzr revid: stw@openerp.com-20120803075633-jf3d5xk3igf5yctb
This commit is contained in:
Stephane Wirtel 2012-08-03 09:56:33 +02:00
parent 4c6a19d013
commit 94d1fa81e4
1 changed files with 8 additions and 0 deletions

View File

@ -1547,6 +1547,7 @@ class stock_move(osv.osv):
cr.execute('select id from stock_tracking where create_uid=%s order by id desc limit 1', (uid,))
res = cr.fetchone()
return (res and res[0]) or False
_name = "stock.move"
_description = "Stock Move"
_order = 'date_expected desc, id'
@ -1744,6 +1745,13 @@ class stock_move(osv.osv):
'date_expected': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
def create(self, cr, uid, vals, context=None):
# TODO
# the create_date is passed in the vals dict, and the ORM has a problem with that !
# make a real patch and remove this workaround
vals.pop('create_date', False)
return super(stock_move, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
if isinstance(ids, (int, long)):
ids = [ids]