summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Wirtel <stw@openerp.com>2012-09-05 11:19:33 +0200
committerStephane Wirtel <stw@openerp.com>2012-09-05 11:19:33 +0200
commit2e7e5ffd095e31d4d911f92328dbd4bc760ff3a1 (patch)
tree7c7444bc537d00ca0edb2287b9c67e5badffe0e2
parent88105a043b010870d759f0e16a459ccbeac8741e (diff)
parent9c03b140ce4444479d64130a6b75f3b44db79701 (diff)
[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
-rw-r--r--addons/event/event.py19
-rw-r--r--addons/event/event_view.xml4
2 files changed, 21 insertions, 2 deletions
diff --git a/addons/event/event.py b/addons/event/event.py
index 7f0c77661e4..e4243a7c7a4 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -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
# ----------------------------------------
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index dce96e4c3cf..a9a4b113db3 100644
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -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"/>