Skip to content
Snippets Groups Projects
Commit 5909a789 authored by Audric Onockx (auon)'s avatar Audric Onockx (auon)
Browse files

[FIX] base_geolocalize : adapt geocoordinates to partner address


Steps :
Install Field Service and Contacts.
Create a FSM task > Customer : Demo.
Note that the displayed address is his Demo's current one.
Click Navigate To : it points this same address.
Go to Contacts > Demo > change the address and return to task.
Note that the displayed address is his Demo's new one. (Or else refresh)

Issue :
Click Navigate To : it points the OLD address.

Cause :
action_fsm_navigate calls partner.geo_localize
only if partner has no geocoordinates.
Yet he still have the old coordinates.

Fix :
Call when the address changes and not in action_fsm_navigate.

closes odoo/odoo#84753

Opw: 2743926
X-original-commit: 0c01f2a2
Related: odoo/enterprise#24456
Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: default avatarOnockx Audric (auon) <auon@odoo.com>
parent 5d7a376a
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,17 @@ class ResPartner(models.Model):
_inherit = "res.partner"
date_localization = fields.Date(string='Geolocation Date')
partner_latitude = fields.Float(compute="_compute_geo_coordinates", readonly=False, store=True)
partner_longitude = fields.Float(compute="_compute_geo_coordinates", readonly=False, store=True)
@api.depends('street', 'zip', 'city', 'state_id', 'country_id')
def _compute_geo_coordinates(self):
for partner in self:
if not (partner.city and partner.country_id):
partner.partner_latitude = 0.0
partner.partner_longitude = 0.0
else:
partner.geo_localize()
@api.model
def _geo_localize(self, street='', zip='', city='', state='', country=''):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment