diff --git a/addons/event/event.py b/addons/event/event.py index bebddb34d17..f01caac175f 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -210,12 +210,6 @@ class event_event(osv.osv): 'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}), 'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}), 'is_subscribed' : fields.function(_subscribe_fnc, type="boolean", string='Subscribed'), - 'city': fields.related('address_id', 'city', type='char', string='City'), - 'street': fields.related('address_id', 'street', type='char', string='Street'), - 'country_id': fields.related('address_id', 'country_id', relation='res.country', type='many2one', string='Country'), - 'state_id': fields.related('address_id', 'state_id', relation="res.country.state", type="many2one", string='Fed. State'), - 'zip': fields.related('address_id','zip', type="char", string="Zip"), - } _defaults = { 'state': 'draft', diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 4cebf3dd309..190445d6c20 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -64,16 +64,17 @@ - - + + - - + + + + + -
diff --git a/addons/event/static/src/js/google_map.js b/addons/event/static/src/js/google_map.js index 7d2681a7369..4a02086b85a 100644 --- a/addons/event/static/src/js/google_map.js +++ b/addons/event/static/src/js/google_map.js @@ -1,4 +1,4 @@ -openerp.event = function(instance){ +openerp.event = function(instance) { instance.web.form.widgets.add('many2one_Geo_address', 'instance.event.Many2OneAddress'); instance.web.GoogleMapConnector = instance.web.Class.extend({ @@ -48,8 +48,14 @@ openerp.event = function(instance){ } (value instanceof Array)?value = parseInt(value[0]):false; var data = new instance.web.DataSet(this,this.field.relation, this.build_context()); - data.read_ids(value,["street","city","country_id"]).done(function(value){ - var address = _.str.sprintf(' %(street)s, %(city)s, %(country_id[1])s', value); + data.read_ids(value,["street","city","zip","country_id"]).done(function(value){ + var address; + if value['country_id'] { + address = _.str.sprintf('%(street)s, %(zip)s %(city)s, %(country_id[1])s', value); + } 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")); }) @@ -65,4 +71,4 @@ openerp.event = function(instance){ this._super(no_recurse); } }); -}; \ No newline at end of file +};