[IMP] Added code for the onchange

Product to Produce:
Product field + Quantity field + Unit of Measure field
should be filled automatically via onchange if you created/selected a Manufacturing Order before saving

bzr revid: psa@tinyerp.com-20121130112434-ajfuq8h0f5u21qyy
This commit is contained in:
Paramjit Singh Sahota
2012-11-30 16:54:34 +05:30
parent 852bbeaa01
commit 28a17a63fe
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -83,6 +83,19 @@ class mrp_production_workcenter_line(osv.osv):
res = date_planned
return {'value':{'date_planned_end': res}}
def onchange_production_id(self, cr, uid, ids, production_id, context=None):
""" Finds UoM of changed product.
@param product_id: Id of changed product.
@return: Dictionary of values.
"""
products = self.pool.get('mrp.production').browse(cr, uid, production_id, context=None)
result = {
'product': products.product_id.id,
'qty': products.product_qty,
'uom': products.product_uom.id,
}
return {'value': result}
_inherit = 'mrp.production.workcenter.line'
_order = "sequence, date_planned"
@@ -76,7 +76,7 @@
<group col="4">
<field colspan="2" name="name"/>
<field name="workcenter_id"/>
<field name="production_id"/>
<field name="production_id" on_change="onchange_production_id(production_id)"/>
<field name="production_state"/>
<field name="sequence"/>
</group>