Skip to content

Commit

Permalink
Porting l10n_nl_postcodeapi to V9
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Mar 13, 2017
1 parent 89fcc12 commit f7dc730
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 63 deletions.
16 changes: 8 additions & 8 deletions l10n_nl_postcodeapi/README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

===================================
Auto-completion for Dutch addresses
===================================

This module contains integration of the excellent and free address completion
service 'PostcodeAPI'. The service allows lookups by zip code and house number,
providing street name and city. The lookups will be triggered in the partner
Expand All @@ -17,7 +20,7 @@ Installation
This module depends on the module partner_street_number, which will split
up the street field into separate fields for street name and number.

This module can be gotten from https://github.com/oca/partner-contact/tree/8.0
This module can be gotten from https://github.com/oca/partner-contact/tree/9.0

You also need to have the 'pyPostcode' Python library by Stefan Jansen
installed (https://pypi.python.org/pypi/pyPostcode).
Expand All @@ -33,25 +36,22 @@ directory, but not loaded by default. You can import the file manually.

Compatibility
=============
This module is compatible with OpenERP 8.0.
This module is compatible with Odoo 9.0.

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/176/8.0
:target: https://runbot.odoo-community.org/runbot/176/9.0

.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-netherlands/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/l10n-netherlands/issues/new?body=module:%20l10n_nl_postcodeapi%0Aversion:%200.1%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.

Credits
=======
Expand Down
6 changes: 3 additions & 3 deletions l10n_nl_postcodeapi/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
'name': 'Integration with PostcodeApi.nu',
'summary': 'Autocomplete Dutch addresses using PostcodeApi.nu',
'version': '8.0.0.1.0',
'version': '9.0.0.1.0',
'author': 'Therp BV,Odoo Community Association (OCA)',
'category': 'Localization',
'website': 'https://github.com/OCA/l10n-netherlands',
Expand All @@ -31,8 +31,8 @@
'data': [
'data/ir_config_parameter.xml',
],
"external_dependencies": {
'external_dependencies': {
'python': ['pyPostcode'],
},
'installable': False,
'installable': True,
}
4 changes: 2 additions & 2 deletions l10n_nl_postcodeapi/data/ir_config_parameter.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data noupdate="1">

<record id="parameter_apikey" model="ir.config_parameter">
Expand All @@ -8,4 +8,4 @@
</record>

</data>
</openerp>
</odoo>
42 changes: 0 additions & 42 deletions l10n_nl_postcodeapi/i18n/l10n_nl_postcodeapi.pot

This file was deleted.

2 changes: 1 addition & 1 deletion l10n_nl_postcodeapi/i18n/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: OpenERP Server 9.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-10 11:03+0000\n"
"PO-Revision-Date: 2014-11-10 11:03+0000\n"
Expand Down
14 changes: 7 additions & 7 deletions l10n_nl_postcodeapi/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_provider_obj(self):
if not apikey or apikey == 'Your API key':
return False
from pyPostcode import Api
provider = Api(apikey)
provider = Api(apikey, (2, 0, 0))
test = provider.getaddress('1053NJ', '334T')
if not test or not test._data:
raise exceptions.Warning(
Expand Down Expand Up @@ -67,9 +67,9 @@ def on_change_zip_street_number(self):
keyword in Python
"""
postal_code = self.zip and self.zip.replace(' ', '')
if (not (postal_code and self.street_number)
or (self.country_id and
self.country_id != self.env.ref('base.nl'))):
country = self.country_id
if not (postal_code and self.street_number) or \
country and country != self.env.ref('base.nl'):
return {}

provider_obj = self.get_provider_obj()
Expand All @@ -78,9 +78,9 @@ def on_change_zip_street_number(self):
pc_info = provider_obj.getaddress(postal_code, self.street_number)
if not pc_info or not pc_info._data:
return {}
self.street_name = pc_info._data['street']
self.city = pc_info._data['town']
self.state_id = self.get_province(pc_info._province)
self.street_name = pc_info.street
self.city = pc_info.town
self.state_id = self.get_province(pc_info.province)

@api.model
def fields_view_get(
Expand Down

0 comments on commit f7dc730

Please sign in to comment.