Skip to content

Commit

Permalink
Merge pull request #487 from etobella/11.0-mig-partner_firstname
Browse files Browse the repository at this point in the history
[11.0] [MIG] partner_firstname: Migration to 11.0
  • Loading branch information
JordiBForgeFlow authored Oct 27, 2017
2 parents 09c3386 + 01a92d1 commit 7ed6045
Show file tree
Hide file tree
Showing 76 changed files with 4,512 additions and 0 deletions.
118 changes: 118 additions & 0 deletions partner_firstname/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

================================
Partner first name and last name
================================

This module was written to extend the functionality of contacts to support
having separate last name and first name.

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

You can configure some common name patterns for the inverse function
in Settings > General settings:

* Lastname Firstname: For example 'Anderson Robert'
* Lastname, Firstname: For example 'Anderson, Robert'
* Firstname Lastname: For example 'Robert Anderson'

After applying the changes, you can recalculate all partners name clicking
"Recalculate names" button. Note: This process could take so much time depending
how many partners there are in database.

You can use *_get_inverse_name* method to get lastname and firstname from a simple string
and also *_get_computed_name* to get a name form the lastname and firstname.
These methods can be overridden to change the format specified above.


Usage
=====

The field *name* becomes a stored function field concatenating the *last name*
and the *first name*. This avoids breaking compatibility with other modules.

Users should fulfill manually the separate fields for *last name* and *first
name*, but in case you edit just the *name* field in some unexpected module,
there is an inverse function that tries to split that automatically. It assumes
that you write the *name* in format configured (*"Lastname Firstname"*, by default),
but it could lead to wrong splitting (because it's just blindly trying to
guess what you meant), so you better specify it manually.

For the same reason, after installing, previous names for contacts will stay in
the *name* field, and the first time you edit any of them you will be asked to
supply the *last name* and *first name* (just once per contact).

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

For further information, please visit:

* https://www.odoo.com/forum/help-1


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

Patterns for the inverse function are configurable only at system level. Maybe
this configuration could depend on partner language, country or company,
as discussed at `this OCA issue <https://github.com/OCA/partner-contact/issues/210>`_


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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner-contact/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.

Credits
=======

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

* Nicolas Bessi <nicolas.bessi@camptocamp.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Vincent Renaville <vincent.renaville@camptocamp.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Holger Brunn <hbrunn@terp.nl>
* Jonathan Nemry <jonathan.nemry@acsone.eu>
* Olivier Laurent <olivier.laurent@acsone.eu>
* Sandy Carter <sandy.carter@savoirfairelinux.com>
* Alexis de Lattre <alexis.delattre@akretion.fr>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Hans Henrik Gabelgaard <hhg@gabelgaard.org>
* Jairo Llopis <j.llopis@grupoesoc.es>
* Adrien Peiffer <adrien.peiffer@acsone.eu>
* Ronald Portier <ronald@therp.nl>
* Sylvain Van Hoof
* Pedro Baeza <pedro.baeza@serviciosbaeza.com>
* Dave Lasley <dave@laslabs.com>

Translations
------------

* Danish: Hans Henrik Gabelgaard
* Italian: Leonardo Donelli
* Spanish: Antonio Espinosa
* Antonio Espinosa <antonioea@antiun.com>

Maintainer
----------

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

This module is maintained by the OCA.

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.
6 changes: 6 additions & 0 deletions partner_firstname/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2013 Nicolas Bessi (Camptocamp SA)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
from .hooks import post_init_hook
30 changes: 30 additions & 0 deletions partner_firstname/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# © 2013 Nicolas Bessi (Camptocamp SA)
# © 2014 Agile Business Group (<http://www.agilebg.com>)
# © 2015 Grupo ESOC (<http://www.grupoesoc.es>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
'name': 'Partner first name and last name',
'summary': "Split first name and last name for non company partners",
'version': '11.0.1.0.0',
'author': "Camptocamp, "
"Grupo ESOC Ingeniería de Servicios, "
"Tecnativa, "
"LasLabs, "
"ACSONE SA/NV, "
"Odoo Community Association (OCA)",
'license': "AGPL-3",
'maintainer': 'Camptocamp, Acsone',
'category': 'Extra Tools',
'website': 'https://odoo-community.org/',
'depends': ['base_setup'],
'post_init_hook': 'post_init_hook',
'data': [
'views/base_config_view.xml',
'views/res_partner.xml',
'views/res_user.xml',
],
'auto_install': False,
'installable': True,
}
12 changes: 12 additions & 0 deletions partner_firstname/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# © 2014-2015 Grupo ESOC (<http://www.grupoesoc.es>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, exceptions


class EmptyNamesError(exceptions.ValidationError):
def __init__(self, record, value=_("No name is set.")):
self.record = record
self._value = value
self.name = _("Error(s) with partner %d's name.") % record.id
self.args = (self.name, value)
11 changes: 11 additions & 0 deletions partner_firstname/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, SUPERUSER_ID


def post_init_hook(cr, _):
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
env['res.partner']._install_partner_firstname()
58 changes: 58 additions & 0 deletions partner_firstname/i18n/am.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_firstname
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-10 03:39+0000\n"
"PO-Revision-Date: 2017-03-10 03:39+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Amharic (https://www.transifex.com/oca/teams/23907/am/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: am\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: partner_firstname
#: sql_constraint:res.partner:0
msgid "Contacts require a name."
msgstr ""

#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:11
#, python-format
msgid "Error(s) with partner %d's name."
msgstr ""

#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_users_firstname
msgid "First name"
msgstr ""

#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_partner_lastname
#: model:ir.model.fields,field_description:partner_firstname.field_res_users_lastname
msgid "Last name"
msgstr ""

#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:8
#, python-format
msgid "No name is set."
msgstr ""

#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_partner
msgid "Partner"
msgstr "ተባባሪ"

#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_users
msgid "Users"
msgstr ""
58 changes: 58 additions & 0 deletions partner_firstname/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_firstname
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-10 03:39+0000\n"
"PO-Revision-Date: 2017-03-10 03:39+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#. module: partner_firstname
#: sql_constraint:res.partner:0
msgid "Contacts require a name."
msgstr ""

#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:11
#, python-format
msgid "Error(s) with partner %d's name."
msgstr ""

#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_users_firstname
msgid "First name"
msgstr ""

#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_partner_lastname
#: model:ir.model.fields,field_description:partner_firstname.field_res_users_lastname
msgid "Last name"
msgstr ""

#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:8
#, python-format
msgid "No name is set."
msgstr ""

#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_partner
msgid "Partner"
msgstr "الشريك"

#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_users
msgid "Users"
msgstr ""
58 changes: 58 additions & 0 deletions partner_firstname/i18n/bg.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_firstname
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-31 01:39+0000\n"
"PO-Revision-Date: 2016-12-31 01:39+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Bulgarian (https://www.transifex.com/oca/teams/23907/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: bg\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: partner_firstname
#: sql_constraint:res.partner:0
msgid "Contacts require a name."
msgstr ""

#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:11
#, python-format
msgid "Error(s) with partner %d's name."
msgstr ""

#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_users_firstname
msgid "First name"
msgstr ""

#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_partner_lastname
#: model:ir.model.fields,field_description:partner_firstname.field_res_users_lastname
msgid "Last name"
msgstr ""

#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:8
#, python-format
msgid "No name is set."
msgstr ""

#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_partner
msgid "Partner"
msgstr "Партньор"

#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_users
msgid "Users"
msgstr ""
Loading

0 comments on commit 7ed6045

Please sign in to comment.