diff --git a/addons/event/__openerp__.py b/addons/event/__openerp__.py index 6de6d2c62c1..85eb78f32f1 100644 --- a/addons/event/__openerp__.py +++ b/addons/event/__openerp__.py @@ -54,6 +54,7 @@ Note that: 'demo_xml': ['event_demo.xml'], 'test': ['test/process/event_draft2done.yml'], 'css': ['static/src/css/*.css'], + 'js': ['static/src/js/event.js'], 'installable': True, 'application': True, 'auto_install': False, diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 9276f77ed9d..87e29a641f2 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -45,124 +45,42 @@ - - - - Events - event.event - form + + + + Event Items Tree + event.items + tree - - - - - - - - - - - - - - - - - - - - - - - Where - - - - - - - - Start: - - - End - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - + + + Event Items Form + event.items + form + + + + + + + + + + + + + + + Events event.event form @@ -190,14 +108,14 @@ - + Where - + @@ -208,6 +126,7 @@ End + @@ -250,6 +169,7 @@ + @@ -278,8 +198,8 @@ - - + + event.event.tree diff --git a/addons/event/static/src/css/event.css b/addons/event/static/src/css/event.css index cebf155081b..c9f9084a583 100644 --- a/addons/event/static/src/css/event.css +++ b/addons/event/static/src/css/event.css @@ -130,7 +130,6 @@ div.oe_fold_column{ { width:380px; height:200px; - border:1px solid black; margin-left:auto; margin-right:auto; text-align: right; diff --git a/addons/event/static/src/js/event.js b/addons/event/static/src/js/event.js new file mode 100644 index 00000000000..6081533397a --- /dev/null +++ b/addons/event/static/src/js/event.js @@ -0,0 +1,52 @@ +openerp.event = function(instance){ + instance.web.form.widgets.add('geo_address', 'instance.event.GeoAddress'); + instance.event.GeoAddress = instance.web.form.AbstractField.extend(_.extend({}, { + + init : function(){ + this._super.apply(this,arguments); + }, + + start:function(){ + }, + + set_input_id:function(id){ + }, + set_value:function(value){ + var self = this; + this.get_address(value).done(function(value){ + var address = _.str.sprintf(' %(street)s, %(city)s, %(country_id[1])s', value); + return self.list_addresses(address); + }); + + }, + get_address:function(value){ + if (!value || value.length == 0){ + return $.Deferred().reject(); + } + return new instance.web.DataSet (this,this.field.relation, this.build_context()).read_ids(value[0],["street","city","country_id"]); + }, + + list_addresses: function(address){ + var geocoder = new google.maps.Geocoder(); + geocoder.geocode( { 'address': address}, function(results, status) + { + if (status == google.maps.GeocoderStatus.OK){ + var lat = results[0].geometry.location.lat(),lng =results[0].geometry.location.lng(); + var myOptions = { + zoom: 17, + center: new google.maps.LatLng(lat,lng), + mapTypeId: google.maps.MapTypeId.ROADMAP + } + return new google.maps.Marker({ + map : new google.maps.Map(document.getElementById("oe_mapbox"),myOptions), + position: new google.maps.LatLng(lat,lng) + }); + } + }); + + }, + get_value:function(){ + } + + })); +}; \ No newline at end of file