Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] l10n_nl_partner_name: Migration to 16.0 #418

Merged
merged 27 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9392ede
[ADD] l10n_nl_partner_name, l10n_nl_partner_salutation
hbrunn Nov 4, 2015
faede2d
[FIX] show empty string if lastname is unset
hbrunn Jan 4, 2016
cd561c6
[UPD] make it work with latest partner-contact
hbrunn Apr 18, 2016
ea41c7d
[FIX] flake8
hbrunn Apr 18, 2016
939c63e
[ADD] tests
hbrunn Apr 19, 2016
b6e0801
[UPD] prefix versions with 8.0
sbidoul Oct 8, 2016
f83297c
[FIX] linting
hbrunn Jan 11, 2017
524cd25
[MIG] Migrates l10n_nl_partner_name
Aug 17, 2017
c9d47ff
[FIX] version number in l10n_nl_partner_name
sbidoul Apr 19, 2018
ce664ec
remove obsolete .pot files [ci skip]
sbidoul Jun 15, 2018
4681ba8
[UPD] Update l10n_nl_partner_name.pot
oca-travis Jun 23, 2018
f6e7d36
[10.0] l10n_nl_partner_name improvements (#128)
hbrunn Jul 19, 2018
12a3e65
[UPD] Update l10n_nl_partner_name.pot
oca-travis Sep 18, 2018
cab45b7
[MIG] l10n_nl_partner_name: Migration to 11.0
Nov 21, 2018
b49eef4
[UPD] Update l10n_nl_partner_name.pot
oca-travis Jan 28, 2019
7a07af8
Update translation files
oca-transbot Mar 3, 2019
407dc63
[MIG] [12.0] l10n_nl_partner_name
hbrunn Jan 12, 2020
84d1c03
[IMP] l10n_nl_partner_name: black, isort, prettier
NL66278 Jan 13, 2022
5cfdc3b
[MIG] l10n_nl_partner_name: Migration to 13.0
NL66278 Jan 13, 2022
1c9ec9e
[WIP] partner_name: update guess names script
NL66278 Feb 18, 2022
6185d21
[UPD] Update l10n_nl_partner_name.pot
Feb 20, 2023
208a100
Update translation files
weblate Feb 20, 2023
e1b564a
[IMP] l10n_nl_partner_name: pre-commit stuff
hbrunn Jul 22, 2024
257ed9c
[MIG] l10n_nl_partner_name: Migration to 16.0
hbrunn Jul 22, 2024
ff42b33
[FIX] l10n_nl_oin: make test compatible with l10n_nl_partner_name
hbrunn Jul 22, 2024
f131cf2
[FIX] l10n_nl_bsn: make test compatible with l10n_nl_partner_name
hbrunn Jul 22, 2024
31b33a0
[IMP] l10n_nl_partner_name: allow to configure infixes
hbrunn Aug 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions l10n_nl_bsn/tests/test_l10n_nl_bsn.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def setUp(self):
self.partner_bsn = self.env["res.partner"].create(
{
"name": "Partner with BSN",
"is_company": True,
"company_id": self.env.company.id,
}
)
Expand Down Expand Up @@ -40,6 +41,7 @@ def test_03_bsn_another_partner(self):
new_partner_bsn = self.env["res.partner"].create(
{
"name": "Partner with BSN - NEW",
"is_company": True,
"bsn_number": "1000.00.009",
"company_id": self.env.company.id,
}
Expand Down
2 changes: 2 additions & 0 deletions l10n_nl_oin/tests/test_l10n_nl_oin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def setUp(self):
self.partner_oin = self.env["res.partner"].create(
{
"name": "Partner with OIN",
"is_company": True,
"company_id": self.env.company.id,
"country_id": self.env.ref("base.nl").id,
"company_type": "company",
Expand Down Expand Up @@ -42,6 +43,7 @@ def test_03_oin_another_partner(self):
new_partner_oin = self.env["res.partner"].create(
{
"name": "Partner with OIN - NEW",
"is_company": True,
"l10n_nl_oin": "12345678901234567890",
"company_id": self.env.company.id,
}
Expand Down
107 changes: 107 additions & 0 deletions l10n_nl_partner_name/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
===================
Dutch partner names
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f8cb1b98fe2136d949f732eeda2394f64a6938aff007ab5ad473286ba230240b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--netherlands-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-netherlands/tree/16.0/l10n_nl_partner_name
:alt: OCA/l10n-netherlands
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-netherlands-16-0/l10n-netherlands-16-0-l10n_nl_partner_name
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-netherlands&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Use Dutch conventions for partner names:

- have infixes
- have initials
- split first and last name (provided by partner_firstname)

**Table of contents**

.. contents::
:local:

Configuration
=============

The module relies on a list of known infixes to get the parsing right:

van, der, den, op, ter, de, v/d, d', 't, te

Also any combination, so *op den*, *van der* etc will also be
recognized.

If you need a different set of infixes, set system parameter
``l10n_nl_partner_name_infixes`` to a comma separated list like

infix1,infix2,etc

Note this replaces the above list.

Known issues / Roadmap
======================

- allow to turn on/off initials and infix separately
- add nickname (roepnaam) field to also turn on and off separately

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-netherlands/issues/new?body=module:%20l10n_nl_partner_name%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Hunki Enterprises BV
* Therp BV

Contributors
------------

- Holger Brunn <[email protected]>
(https://hunki-enterprises.com)
- Ronald Portier <[email protected]>
- George Daramouskas <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/l10n-netherlands <https://github.com/OCA/l10n-netherlands/tree/16.0/l10n_nl_partner_name>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions l10n_nl_partner_name/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
14 changes: 14 additions & 0 deletions l10n_nl_partner_name/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2017-2022 Therp BV <https://therp.nl>.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Dutch partner names",
"version": "16.0.1.0.0",
"summary": "Adapt parter names to Dutch conventions (support infix)",
"author": "Hunki Enterprises BV, Therp BV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-netherlands",
"category": "Contact management",
"depends": ["partner_firstname"],
"data": ["views/res_partner.xml", "data/ir.config_parameter.xml"],
"installable": True,
"license": "AGPL-3",
}
7 changes: 7 additions & 0 deletions l10n_nl_partner_name/data/ir.config_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<record id="param_name_order" model="ir.config_parameter">
<field name="key">partner_names_order</field>
<field name="value">first_last</field>
</record>
</odoo>
47 changes: 47 additions & 0 deletions l10n_nl_partner_name/i18n/l10n_nl_partner_name.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_nl_partner_name
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \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_partner_name
#: model:ir.model,name:l10n_nl_partner_name.model_res_partner
msgid "Contact"
msgstr ""

#. module: l10n_nl_partner_name
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "First name"
msgstr ""

#. module: l10n_nl_partner_name
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_partner__infix
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_users__infix
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "Infix"
msgstr ""

#. module: l10n_nl_partner_name
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_partner__initials
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_users__initials
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "Initials"
msgstr ""

#. module: l10n_nl_partner_name
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "Last name"
msgstr ""
53 changes: 53 additions & 0 deletions l10n_nl_partner_name/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_nl_partner_name
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-02 14:42+0000\n"
"PO-Revision-Date: 2013-10-02 14:42+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: l10n_nl_partner_name
#: model:ir.model,name:l10n_nl_partner_name.model_res_partner
msgid "Contact"
msgstr ""

#. module: l10n_nl_partner_name
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "First name"
msgstr ""

#. module: l10n_nl_partner_name
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_partner__infix
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_users__infix
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "Infix"
msgstr "Tussenvoegsel"

#. module: l10n_nl_partner_name
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_partner__initials
#: model:ir.model.fields,field_description:l10n_nl_partner_name.field_res_users__initials
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "Initials"
msgstr "Voorletters"

#. module: l10n_nl_partner_name
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_form_firstname
#: model_terms:ir.ui.view,arch_db:l10n_nl_partner_name.view_partner_simple_form_firstname
msgid "Last name"
msgstr ""

#~ msgid "Partner"
#~ msgstr "Relatie"
2 changes: 2 additions & 0 deletions l10n_nl_partner_name/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import res_partner
77 changes: 77 additions & 0 deletions l10n_nl_partner_name/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright 2017-2022 Therp BV <https://therp.nl>.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models


class ResPartner(models.Model):
"""Extend res.partner with extra fields for Dutch names."""

_inherit = "res.partner"

initials = fields.Char()
infix = fields.Char()

@api.depends("firstname", "lastname", "initials", "infix")
def _compute_name(self):
for record in self:
record.name = record._get_computed_name(
record.lastname, record.firstname, record.initials, record.infix
)

def _inverse_name(self):
for record in self:
parts = record._get_inverse_name(record.name, record.is_company)
record.update(parts)

@api.model
def _get_computed_name(self, lastname, firstname, initials=None, infix=None):
return " ".join(
filter(
None,
(firstname, ("(%s)" % initials) if initials else None, infix, lastname),
)
)

@api.model
def _get_inverse_name(self, name, is_company=False):
if is_company:
return super()._get_inverse_name(name, is_company=is_company)

def add_token(key, value):
result[key] += (result[key] and " " or "") + value

infixes = self._l10n_nl_partner_name_infixes()
result = dict.fromkeys(("firstname", "lastname", "initials", "infix"), "")
tokens = (name or "").split()
while len(tokens) > 1:
token = tokens.pop(0)
if all((c.isupper() or c == ".") for c in token):
add_token("initials", token)
elif token[:1] == "(" and token[-1:] == ")":
add_token("initials", token[1:-1])
elif (
len(tokens) and " ".join([token.lower(), tokens[0].lower()]) in infixes
):
add_token("infix", " ".join([token.lower(), tokens[0].lower()]))
tokens.pop(0)
elif token.lower() in infixes:
add_token("infix", token)
elif result["infix"]:
tokens.insert(0, token)
break
else:
add_token("firstname", token)
result["lastname"] = " ".join(tokens)
return result

def _l10n_nl_partner_name_infixes(self):
return tuple(
map(
str.strip,
self.env["ir.config_parameter"]
.get_param(
"l10n_nl_partner_name_infixes", "van,der,den,op,ter,de,v/d,d','t,te"
)
.split(","),
)
)
11 changes: 11 additions & 0 deletions l10n_nl_partner_name/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The module relies on a list of known infixes to get the parsing right:

van, der, den, op, ter, de, v/d, d', 't, te

Also any combination, so *op den*, *van der* etc will also be recognized.

If you need a different set of infixes, set system parameter `l10n_nl_partner_name_infixes` to a comma separated list like

infix1,infix2,etc

Note this replaces the above list.
3 changes: 3 additions & 0 deletions l10n_nl_partner_name/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Holger Brunn \<[email protected]> (https://hunki-enterprises.com)
- Ronald Portier \<[email protected]>
- George Daramouskas \<[email protected]>
4 changes: 4 additions & 0 deletions l10n_nl_partner_name/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Use Dutch conventions for partner names:
- have infixes
- have initials
- split first and last name (provided by partner\_firstname)
2 changes: 2 additions & 0 deletions l10n_nl_partner_name/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- allow to turn on/off initials and infix separately
- add nickname (roepnaam) field to also turn on and off separately
Binary file added l10n_nl_partner_name/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading