Skip to content
Extraits de code Groupes Projets
Valider 5f52cb34 rédigé par Jordan's avatar Jordan
Parcourir les fichiers

[modif] migration v10 -> v12

parent d732ff03
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# -*- coding: utf-8 -*- # © 2020 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
# © 2017 Le Filament (<http://www.le-filament.com>)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{ {
'name': 'Nominatim Geolocalize', 'name': 'Nominatim Geolocalize',
'summary': 'Get partner coordinate using Nominatim API', 'summary': 'Get partner coordinate using Nominatim API',
'version': '10.0.1.0.0', 'version': '12.0.1.0.0',
'license': 'LGPL-3', 'license': 'AGPL-3',
'category': 'Partner', 'category': 'Partner',
'author': 'Odoo SA, Le Filament', 'author': 'Odoo SA, Le Filament',
'description': """ 'installable': True,
Nominatim Geolocalize
========================
Get partner coordinate using Nominatim API
""",
'depends': ['base'], 'depends': ['base'],
'data': [ 'data': [
'datas/cron.xml', 'datas/cron.xml',
'views/res_partner.xml', 'views/res_partner.xml',
], ]
'installable': True,
} }
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
<field name="interval_type">days</field> <field name="interval_type">days</field>
<field name="numbercall">-1</field> <field name="numbercall">-1</field>
<field name="nextcall" >2018-01-31 02:20:00</field> <field name="nextcall" >2018-01-31 02:20:00</field>
<field name="model">res.partner</field> <field name="model_id" ref="model_res_partner"/>
<field name="function">_cron_geolocalize</field> <field name="state">code</field>
<field name="code">model._cron_geolocalize()</field>
</record> </record>
</data> </data>
</odoo> </odoo>
# -*- coding: utf-8 -*-
# Copyright (c) 2004-2015 Odoo S.A. (original module : base_geolocalize) # Copyright (c) 2004-2015 Odoo S.A. (original module : base_geolocalize)
# © 2018 Le Filament (<http://www.le-filament.com>) # © 2020 Le Filament (<http://www.le-filament.com>)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
import json import json
import urllib2 import urllib.request
import time import time
from odoo import api, fields, models, tools, _ from odoo import api, fields, models, tools, _
...@@ -15,11 +14,11 @@ def geo_find(addr): ...@@ -15,11 +14,11 @@ def geo_find(addr):
if not addr: if not addr:
return None return None
url = 'https://nominatim.openstreetmap.org/search.php/' url = 'https://nominatim.openstreetmap.org/search.php/'
url += urllib2.quote(addr.encode('utf8')) url += urllib.request.quote(addr.encode('utf8'))
url += '?format=json' url += '?format=json'
try: try:
result = json.load(urllib2.urlopen(url)) result = json.load(urllib.request.urlopen(url))
except Exception as e: except Exception as e:
raise UserError(_('Cannot contact geolocation servers. Please make \ raise UserError(_('Cannot contact geolocation servers. Please make \
sure that your Internet connection is up and \ sure that your Internet connection is up and \
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter