-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
: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 | ||
form views when a zip code or house number is entered or modified. Only | ||
Dutch addresses (which is assumed to include addresses with no country) are | ||
auto-completed. | ||
|
||
More info about the lookup service here: http://www.postcodeapi.nu/ | ||
|
||
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 | ||
|
||
You also need to have the 'pyPostcode' Python library by Stefan Jansen | ||
installed (https://pypi.python.org/pypi/pyPostcode). | ||
|
||
Configuration | ||
============= | ||
Please enter the API key that you request from PostcodeAPI into the system | ||
parameter 'l10n_nl_postcodeapi.apikey' | ||
|
||
Provinces are autocompleted if a country state with the exact name is found in | ||
the system. A CSV file with the Dutch provinces is included in the data | ||
directory, but not loaded by default. You can import the file manually. | ||
|
||
Compatibility | ||
============= | ||
This module is compatible with OpenERP 8.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 | ||
|
||
.. 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**>`_. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Stefan Rijnhart (Therp BV) <stefan@therp.nl> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: http://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: http://odoo-community.org | ||
|
||
This module is maintained by the OCA at https://github.com/OCA/l10n-netherlands | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>). | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
{ | ||
'name': 'Integration with PostcodeApi.nu', | ||
'summary': 'Autocomplete Dutch addresses using PostcodeApi.nu', | ||
'version': '0.1', | ||
'author': 'Therp BV', | ||
'category': 'Localization', | ||
'website': 'https://github.com/OCA/l10n-netherlands', | ||
'license': 'AGPL-3', | ||
'depends': ['partner_street_number'], | ||
'data': [ | ||
'data/ir_config_parameter.xml', | ||
], | ||
"external_dependencies": { | ||
'python': ['pyPostcode'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<openerp> | ||
<data noupdate="1"> | ||
|
||
<record id="parameter_apikey" model="ir.config_parameter"> | ||
<field name="key">l10n_nl_postcodeapi.apikey</field> | ||
<field name="value">Your API key</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
id,country_id,name,code | ||
,nl,Drenthe,DR | ||
,nl,Flevoland,FL | ||
,nl,Friesland,FR | ||
,nl,Gelderland,GD | ||
,nl,Groningen,GR | ||
,nl,Limburg,LB | ||
,nl,Noord-Brabant,NB | ||
,nl,Noord-Holland,NH | ||
,nl,Overijssel,OV | ||
,nl,Utrecht,UT | ||
,nl,Zeeland,ZH | ||
,nl,Zuid-Holland,ZL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of OpenERP Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_nl_postcodeapi | ||
# | ||
msgid "" | ||
msgstr "" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:addons/l10n_nl_postcodeapi/model/res_partner.py:46 | ||
#, python-format | ||
msgid "" | ||
"Could not verify the connection with the address lookup service (if you want " | ||
"to get rid of this message, please rename or delete the system parameter " | ||
"'l10n_nl_postcodeapi.apikey')." | ||
msgstr "" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:_description:0 | ||
#: model:ir.model,name:l10n_nl_postcodeapi.model_res_country_state | ||
#, python-format | ||
msgid "Country state" | ||
msgstr "" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:addons/l10n_nl_postcodeapi/model/res_partner.py:45 | ||
#, python-format | ||
msgid "Error" | ||
msgstr "" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:_description:0 | ||
#: model:ir.model,name:l10n_nl_postcodeapi.model_res_partner | ||
#, python-format | ||
msgid "Partner" | ||
msgstr "" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:_description:0 | ||
#: model:ir.model,name:l10n_nl_postcodeapi.model_ir_config_parameter | ||
#, python-format | ||
msgid "ir.config_parameter" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Translation of OpenERP Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_nl_postcodeapi | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: OpenERP Server 7.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" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:addons/l10n_nl_postcodeapi/model/res_partner.py:46 | ||
#, python-format | ||
msgid "Could not verify the connection with the address lookup service (if you want to get rid of this message, please rename or delete the system parameter 'l10n_nl_postcodeapi.apikey')." | ||
msgstr "De verbinding met de postcodeserver kon niet gevalideerd worden (als je deze melding niet meer wilt zien, hernoem of verwijder dan de systeemparameter 'l10n_nl_postcodeapi.apikey')." | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:_description:0 | ||
#: model:ir.model,name:l10n_nl_postcodeapi.model_res_country_state | ||
#, python-format | ||
msgid "Country state" | ||
msgstr "Staat" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:addons/l10n_nl_postcodeapi/model/res_partner.py:45 | ||
#, python-format | ||
msgid "Error" | ||
msgstr "Fout" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:_description:0 | ||
#: model:ir.model,name:l10n_nl_postcodeapi.model_res_partner | ||
#, python-format | ||
msgid "Partner" | ||
msgstr "Relatie" | ||
|
||
#. module: l10n_nl_postcodeapi | ||
#: code:_description:0 | ||
#: model:ir.model,name:l10n_nl_postcodeapi.model_ir_config_parameter | ||
#, python-format | ||
msgid "ir.config_parameter" | ||
msgstr "ir.config_parameter" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import res_partner | ||
from . import ir_config_parameter | ||
from . import res_country_state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>). | ||
# | ||
# @autors: Stefan Rijnhart, Ronald Portier | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from openerp import models, api | ||
|
||
|
||
class IrConfigParameter(models.Model): | ||
_inherit = 'ir.config_parameter' | ||
|
||
@api.model | ||
def create(self, vals): | ||
""" | ||
Clear the postcode provider cache when the API | ||
key is created | ||
""" | ||
if vals.get('key') == 'l10n_nl_postcodeapi.apikey': | ||
partner_obj = self.env['res.partner'] | ||
partner_obj.get_provider_obj.clear_cache(partner_obj) | ||
return super(IrConfigParameter, self).create(vals) | ||
|
||
@api.multi | ||
def write(self, vals): | ||
""" | ||
Clear the postcode provider cache when the API | ||
key is modified | ||
""" | ||
key = 'l10n_nl_postcodeapi.apikey' | ||
if (vals.get('key') == key or | ||
self.search([('id', 'in', self.ids), ('key', '=', key)])): | ||
partner_obj = self.env['res.partner'] | ||
partner_obj.get_provider_obj.clear_cache(partner_obj) | ||
return super(IrConfigParameter, self).write(vals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>). | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from openerp import models, api | ||
|
||
|
||
class ResCountryState(models.Model): | ||
_inherit = 'res.country.state' | ||
|
||
@api.multi | ||
def write(self, vals): | ||
""" | ||
Clear the postcode provider cache when the state | ||
table is altered. | ||
""" | ||
self.env['res.partner'].get_province.clear_cache( | ||
self.env['res.partner']) | ||
return super(ResCountryState, self).write(vals) | ||
|
||
@api.model | ||
def create(self, vals): | ||
""" | ||
Clear the postcode provider cache when the state | ||
table is altered. | ||
""" | ||
self.env['res.partner'].get_province.clear_cache( | ||
self.env['res.partner']) | ||
return super(ResCountryState, self).create(vals) | ||
|
||
@api.multi | ||
def unlink(self): | ||
""" | ||
Clear the postcode provider cache when the state | ||
table is altered. | ||
""" | ||
self.env['res.partner'].get_province.clear_cache( | ||
self.env['res.partner']) | ||
return super(ResCountryState, self).unlink() |
Oops, something went wrong.