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