odoo-addons icon indicating copy to clipboard operation
odoo-addons copied to clipboard

City doesn't get send to google when housenumber is not present

Open AtraXionAartselaar opened this issue 4 years ago • 3 comments

Hi First all great tool you have made; very usefull !

I found an error. When an user only fills in the streetname and not the housenumber. The city ‘locality’ (‘municipality’, ..) doesn't get filled in. So Google responses there is no city... because of that "administrative_area_level_2" get"s filled in as city name which is not correct

In addition you'll find a zip file with a video explaining it. First time I show the bug the second time I show the normal behavior when the housenumer is present.

Odoo city missing.zip

Response from Google because city was missing: /**/_xdc_._akyo20 && _xdc_._akyo20( { "html_attributions" : [], "result" : { "address_components" : [ { "long_name" : "Antwerpsestraat", "short_name" : "Antwerpsestraat", "types" : [ "route" ] }, { "long_name" : "Antwerpen", "short_name" : "AN", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Vlaanderen", "short_name" : "Vlaanderen", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "België", "short_name" : "BE", "types" : [ "country", "political" ] } ], "adr_address" : "\u003cspan class=\"street-address\"\u003eAntwerpsestraat\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eBelgië\u003c/span\u003e", "formatted_address" : "Antwerpsestraat", "geometry" : { "location" : { "lat" : 51.0977415, "lng" : 4.3673673 }, "viewport" : { "northeast" : { "lat" : 51.09909048029149, "lng" : 4.368716280291502 }, "southwest" : { "lat" : 51.09639251970849, "lng" : 4.366018319708497 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png", "id" : "6a8d281b4dedc7c4c576eacebed1d2f8a3d0b7d4", "name" : "Antwerpsestraat", "place_id" : "EhhBbnR3ZXJwc2VzdHJhYXQsIEJlbGdpdW0iLiosChQKEgmpPkvg4fHDRxHfREQPaMDxuBIUChIJH4agHvrvw0cR-Gppir5EdpU", "reference" : "EhhBbnR3ZXJwc2VzdHJhYXQsIEJlbGdpdW0iLiosChQKEgmpPkvg4fHDRxHfREQPaMDxuBIUChIJH4agHvrvw0cR-Gppir5EdpU", "scope" : "GOOGLE", "types" : [ "route" ], "url" : "https://maps.google.com/?q=Antwerpsestraat&ftid=0x47c3f1e1e04b3ea9:0xb8f1c0680f4444df", "utc_offset" : 120 }, "status" : "OK" }

AtraXionAartselaar avatar Apr 20 '20 09:04 AtraXionAartselaar

@AtraXionAartselaar thank you. can you tell me what should be the correct address? actually, you can change the widget component address via widget options

gityopie avatar Apr 25 '20 15:04 gityopie

Hi gityopie,

The address should have been: Street: Antwerpsestraat City: Boom State: administrative_area_level_2: Antwerpen (AN) Country: Belgium

But the script changed it to Street: Antwerpsestraat City: AN (Antwerpen) State: administrative_area_level_2: Antwerpen (AN) Country: Belgium

This is what happens: Please also check the video...

  1. The user types a streetname
  2. The script calls Google and suggests some addresses.
  3. The user selects an address but there is no housenumber present.
  4. So the script sends the address to Google but without a city.
  5. Google answers with an address without a city. And the script fills in the answer. And uses the administrative_area_level_2 as the city name which is completely wrong!

From: Yopi Angi [email protected] Sent: Saturday, April 25, 2020 5:26 PM To: gityopie/odoo-addons [email protected] Cc: Atraxion Matthias ♣ [email protected]; Mention [email protected] Subject: Re: [gityopie/odoo-addons] City doesn't get send to google when housenumber is not present (#129)

@AtraXionAartselaarhttps://github.com/AtraXionAartselaar thank you. can you tell me what should be the correct address? actually, you can change the widget component address via widget options

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/gityopie/odoo-addons/issues/129#issuecomment-619395941, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK7ENZLPDGU5CFDCODAXCNTROL6JPANCNFSM4MMI37XQ.

AtraXionAartselaar avatar Apr 27 '20 07:04 AtraXionAartselaar

@AtraXionAartselaar Ok, I got the issue and thanks for the explanation I pushed a new branch https://github.com/gityopie/odoo-addons/tree/12.0-autocomplete-dev and introduced four new modules for the google autocomplete. Please have a look on that modules (I also fixed your issue there).

For the module sale_maps, the autocomplete are still there but I would like you to check the new modules instead. I think sale_maps it's not relavant anymore just to add the autocomplete on this module and more, I've moved the modification defined on that module to contacts_maps

Waiting your feedback for those new modules :) Thanks

gityopie avatar Apr 28 '20 17:04 gityopie