[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
This commit is contained in:
parent
439cdb6871
commit
6b7e6f6b90
|
@ -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:
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Update Product Quantity">
|
||||
<group>
|
||||
<field name="new_quantity" />
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="location_id" groups="stock.group_locations"/>
|
||||
<field name="location_id" groups="stock.group_locations" on_change="onchange_location_id(location_id, product_id, context)"/>
|
||||
<field name="new_quantity"/>
|
||||
<field name="lot_id" context="{'search_default_product_id':product_id,'default_product_id':product_id}" groups="stock.group_production_lot"/>
|
||||
<p groups="stock.group_production_lot" class="oe_grey">
|
||||
When you select a serial number (lot), the quantity is corrected with respect to
|
||||
|
|
Loading…
Reference in New Issue