[FIX] google map on event part1
bzr revid: al@openerp.com-20120525191127-v5o88etlbdq0jbzn
This commit is contained in:
parent
cdd8b9d47a
commit
df59b0b7d2
|
@ -39,7 +39,7 @@ Note that:
|
|||
Association / Configuration / Types of Events
|
||||
""",
|
||||
'author': 'OpenERP SA',
|
||||
'depends': ['email_template'],
|
||||
'depends': ['email_template','google_map'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'security/event_security.xml',
|
||||
|
@ -53,7 +53,6 @@ Note that:
|
|||
],
|
||||
'demo_xml': ['event_demo.xml'],
|
||||
'test': ['test/process/event_draft2done.yml'],
|
||||
'js': ['static/src/js/google_map.js'],
|
||||
'css': ['static/src/css/event.css'],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<group col="2" colspan="2" class="oe_form_group_label_border" style="margin-top: 20px;">
|
||||
<field name="type" on_change="onchange_event_type(type,context)"/>
|
||||
<field name="user_id"/>
|
||||
<field name="address_id" widget ="many2one_Geo_address"/>
|
||||
<field name="address_id" widget ="many2one_address_google_map" widget_option="{'placeholder':'.oe_form_google_map'}"/>
|
||||
<field name="address"/>
|
||||
</group>
|
||||
<group col="2" colspan="2" class="oe_form_group_label_border" style="margin-top: 20px;">
|
||||
|
@ -77,7 +77,7 @@
|
|||
<field name="register_min"/>
|
||||
<field name="register_max"/>
|
||||
</group>
|
||||
<div id="oe_mapbox" class="oe_mapbox"></div>
|
||||
<div class="oe_form_google_map"></div>
|
||||
</group>
|
||||
|
||||
<notebook colspan="4">
|
||||
|
|
|
@ -38,6 +38,7 @@ Using this you can directly open Google Map from the URL widget.""",
|
|||
'google_map_view.xml',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'js': ['static/src/js/google_map.js'],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'certificate': '0029498930765',
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
<label string="Street2 : " align="1.0"/>
|
||||
<group colspan="1" col="2">
|
||||
<field name="street2" nolabel="1"/>
|
||||
<button name="open_map"
|
||||
string="Map" type="object" icon="gtk-zoom-in"/>
|
||||
<button name="open_map" string="Map" type="object" icon="gtk-zoom-in"/>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
openerp.event = function(instance) {
|
||||
instance.web.form.widgets.add('many2one_Geo_address', 'instance.event.Many2OneAddress');
|
||||
|
||||
instance.web.GoogleMapConnector = instance.web.Class.extend({
|
||||
openerp.event = function(instance, mod) {
|
||||
instance.web.form.widgets.add('many2one_address_google_map', 'instance.event.Many2OneAddress');
|
||||
|
||||
instance.google_map.GoogleMapConnector = instance.web.Class.extend({
|
||||
init: function(){
|
||||
this.googleMapsLoaded = $.Deferred();
|
||||
this.map_load();
|
||||
|
@ -36,10 +36,10 @@ openerp.event = function(instance) {
|
|||
});
|
||||
},
|
||||
});
|
||||
instance.event.Many2OneAddress = instance.web.form.FieldMany2One.extend({
|
||||
instance.google_map.Many2OneAddress = instance.web.form.FieldMany2One.extend({
|
||||
init: function(field_manager, node){
|
||||
this._super(field_manager, node);
|
||||
this.map = new instance.web.GoogleMapConnector();
|
||||
this.map = new instance.google_map.GoogleMapConnector();
|
||||
},
|
||||
get_address:function(value){
|
||||
var self = this;
|
||||
|
@ -55,9 +55,8 @@ openerp.event = function(instance) {
|
|||
} else {
|
||||
address = _.str.sprintf('%(street)s, %(zip)s %(city)s', value);
|
||||
}
|
||||
|
||||
self.map.googleMapsLoaded.done(function(){
|
||||
self.map.render_map(address,document.getElementById("oe_mapbox"));
|
||||
self.map.render_map(address,self.$(self.options.selector)[0]);
|
||||
})
|
||||
});
|
||||
},
|
||||
|
@ -65,7 +64,6 @@ openerp.event = function(instance) {
|
|||
this._super(value);
|
||||
this.get_address(value);
|
||||
},
|
||||
|
||||
render_value:function(no_recurse){
|
||||
this.get_address(this.get("value"));
|
||||
this._super(no_recurse);
|
Loading…
Reference in New Issue