[FIX] sale_stock: use current product's UoM to check availability
When selecting a product in a sale.order, the asked quantity is verified against the available quantity. If the user changes the UoM or the onchange from super call changes it, the context should be updated accordingly. Fixes #2559
This commit is contained in:
parent
717e4106ad
commit
5be3ac1fd0
|
@ -601,6 +601,14 @@ class sale_order_line(osv.osv):
|
|||
res['value'].update({'product_packaging': False})
|
||||
return res
|
||||
|
||||
# set product uom in context to get virtual stock in current uom
|
||||
if res.get('value', {}).get('product_uom'):
|
||||
# use the uom changed by super call
|
||||
context.update({'uom': res['value']['product_uom']})
|
||||
elif uom:
|
||||
# fallback on selected
|
||||
context.update({'uom': uom})
|
||||
|
||||
#update of result obtained in super function
|
||||
product_obj = product_obj.browse(cr, uid, product, context=context)
|
||||
res['value']['delay'] = (product_obj.sale_delay or 0.0)
|
||||
|
|
Loading…
Reference in New Issue