[IMP] event: Add an onchange event on the location address, this

onchange will load the city, street and zipcode of the selected
address.
[MERGE] event: Show the google maps.

bzr revid: stw@openerp.com-20120905091933-t77gwdlrfcq9uhup
This commit is contained in:
Stephane Wirtel 2012-09-05 11:19:33 +02:00
commit 2e7e5ffd09
2 changed files with 21 additions and 2 deletions

View File

@ -262,6 +262,25 @@ class event_event(osv.osv):
}
return {'value': dic}
def on_change_address_id(self, cr, uid, ids, address_id, context=None):
values = {
'street' : False,
'city' : False,
'zip' : False,
}
if isinstance(address_id, (long, int)):
address = self.pool.get('res.partner').browse(cr, uid, address_id, context=context)
values.update({
'street' : address.street,
'city' : address.city,
'zip' : address.zip,
})
return {'value' : values}
# ----------------------------------------
# OpenChatter methods and notifications
# ----------------------------------------

View File

@ -124,7 +124,7 @@
<group>
<label for="address_id" string="Location Address"/>
<div>
<field name="address_id" widget="many2one_address_google_map" widget_option="{'placeholder':'.oe_google_map'}"/>
<field name="address_id" widget="many2one_address_google_map" widget_option="{'placeholder':'.oe_google_map'}" on_change="on_change_address_id(address_id)" />
<field name="street" placeholder="Street..."/>
<div>
<field name="zip" class="oe_inline" placeholder="Zip"/>
@ -143,7 +143,7 @@
</group>
</group>
</div>
<!-- <div class="oe_right" style="height: 200px"></div> -->
<div class="oe_google_map" style="height: 200px"></div>
<notebook>
<page string="Event Description">
<field name="note" colspan="4" nolabel="1"/>