[IMP] Onchange on picking type in pos.config

bzr revid: jco@openerp.com-20140324125441-eh4wb77pwzop0zon
This commit is contained in:
Josse Colpaert 2014-03-24 13:54:41 +01:00
parent 641fc49eeb
commit 2655798706
2 changed files with 10 additions and 1 deletions

View File

@ -162,6 +162,14 @@ class pos_config(osv.osv):
'company_id': _get_default_company,
}
def onchange_picking_type_id(self, cr, uid, ids, picking_type_id, context=None):
p_type_obj = self.pool.get("stock.picking.type")
p_type = p_type_obj.browse(cr, uid, picking_type_id, context=context)
if p_type.default_location_src_id and p_type.default_location_src_id.usage == 'internal' and p_type.default_location_dest_id and p_type.default_location_dest_id.usage == 'customer':
return {'value': {'stock_location_id': p_type.default_location_src_id.id}}
return False
def set_active(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state' : 'active'}, context=context)

View File

@ -591,7 +591,8 @@
<field name="name"/>
</h1>
<group col="4">
<field name="picking_type_id" widget="selection" groups="stock.group_locations" /><!-- TODO Group? -->
<field name="picking_type_id" widget="selection" groups="stock.group_locations"
on_change="onchange_picking_type_id(picking_type_id)"/>
<field name="stock_location_id" groups="stock.group_locations"/>
<field name="pricelist_id" groups="product.group_sale_pricelist"/>
<field name="currency_id" invisible="1"/>