From 6b7e6f6b9089e0fb72e17a18be3d3d738bd46adc Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 15 May 2015 15:47:35 +0200 Subject: [PATCH] [ADD] stock: onchange on wizard stock_change_product_qty The proposed value for the new quantity on hand is calculated for the chosen warehouse. opw-639641 --- addons/stock/wizard/stock_change_product_qty.py | 8 ++++++++ addons/stock/wizard/stock_change_product_qty_view.xml | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/stock/wizard/stock_change_product_qty.py b/addons/stock/wizard/stock_change_product_qty.py index 9c495106a2f..a1e7e39e49a 100644 --- a/addons/stock/wizard/stock_change_product_qty.py +++ b/addons/stock/wizard/stock_change_product_qty.py @@ -120,4 +120,12 @@ class stock_change_product_qty(osv.osv_memory): inventory_obj.action_done(cr, uid, [inventory_id], context=context) return {} + def onchange_location_id(self, cr, uid, ids, location_id, product_id, context=None): + if location_id: + qty_wh = 0.0 + qty = self.pool.get('product.product')._product_available(cr, uid, [product_id], context=dict(context or {}, location=location_id)) + if product_id in qty: + qty_wh = qty[product_id]['qty_available'] + return { 'value': { 'new_quantity': qty_wh } } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock/wizard/stock_change_product_qty_view.xml b/addons/stock/wizard/stock_change_product_qty_view.xml index 7c11189d1c3..4bf556fcaef 100644 --- a/addons/stock/wizard/stock_change_product_qty_view.xml +++ b/addons/stock/wizard/stock_change_product_qty_view.xml @@ -7,9 +7,9 @@
- - + +

When you select a serial number (lot), the quantity is corrected with respect to