mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
IMP sale_planner better error handling and fixing '-' in res.partner.geo_localize()
This commit is contained in:
@@ -15,8 +15,8 @@ class Partner(models.Model):
|
||||
for partner in self.with_context(lang='en_US'):
|
||||
if ZipcodeSearchEngine and partner.zip:
|
||||
with ZipcodeSearchEngine() as search:
|
||||
zipcode = search.by_zipcode(partner.zip)
|
||||
if zipcode:
|
||||
zipcode = search.by_zipcode(str(self.zip).split('-')[0])
|
||||
if zipcode and zipcode['Latitude']:
|
||||
partner.write({
|
||||
'partner_latitude': zipcode['Latitude'],
|
||||
'partner_longitude': zipcode['Longitude'],
|
||||
|
||||
@@ -55,7 +55,7 @@ class FakePartner():
|
||||
|
||||
@property
|
||||
def date_localization(self):
|
||||
if not hasattr(self, 'date_localization'):
|
||||
if not hasattr(self, 'date_localization') and self.date_localization:
|
||||
self.date_localization = 'TODAY!'
|
||||
# The fast way.
|
||||
if ZipcodeSearchEngine and self.zip:
|
||||
|
||||
Reference in New Issue
Block a user