[ADD] module pms-l10n-es (#21)

* [ADD] Add modulo pms-l10n-es and tests

* [ADD] Add res_parter and checkin_partner models

* [WIP] Base location pms taxonomy

* [WIP] pms-l10n-es: View improvement

Co-authored-by: Darío Lodeiros <dario@commitsun.com>
This commit is contained in:
Sara
2020-12-22 11:06:01 +01:00
committed by GitHub
parent d82c91c854
commit e19bac38b6
16 changed files with 1045 additions and 0 deletions

138
pms-l10n-es/README.rst Normal file
View File

@@ -0,0 +1,138 @@
================================
Partner first name and last name
================================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fpartner--contact-lightgray.png?logo=github
:target: https://github.com/OCA/partner-contact/tree/14.0/partner_firstname
:alt: OCA/partner-contact
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_firstname
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/134/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module was written to extend the functionality of contacts to support
having separate last name and first name.
**Table of contents**
.. contents::
:local:
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).
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 <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_firstname%0Aversion:%2014.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
~~~~~~~
* Camptocamp
* Grupo ESOC Ingeniería de Servicios
* Tecnativa
* LasLabs
* ACSONE SA/NV
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>
* Graeme Gellatly <graeme@o4sb.com>
* Laurent Mignon <laurent.mignon@acsone.eu>
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/partner-contact <https://github.com/OCA/partner-contact/tree/14.0/partner_firstname>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

1
pms-l10n-es/__init__.py Normal file
View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,26 @@
# Copyright 2013 Nicolas Bessi (Camptocamp SA)
# Copyright 2014 Agile Business Group (<http://www.agilebg.com>)
# Copyright 2015 Grupo ESOC (<http://www.grupoesoc.es>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Adaptation to spanish law",
"version": "14.0.1.0.0",
"author": "CommitSun, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": True,
"category": "Localization",
"website": "https://github.com/OCA/pms",
"depends": [
"pms",
"partner_firstname",
"partner_second_lastname",
"partner_contact_gender",
"partner_contact_birthdate",
],
"data": [
"views/pms_checkin_partner_views.xml",
"views/res_partner_views.xml",
],
"installable": True,
}

112
pms-l10n-es/i18n/es.po Normal file
View File

@@ -0,0 +1,112 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_firstname
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 20:26+0000\n"
"PO-Revision-Date: 2018-07-13 09:34+0000\n"
"Last-Translator: Enric Tobella <etobella@creublanca.es>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.0.1\n"
#. module: partner_firstname
#: code:addons/partner_firstname/models/res_users.py:0
#, python-format
msgid "%s (copy)"
msgstr ""
#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_config_settings
#, fuzzy
msgid "Config Settings"
msgstr "res.config.settings"
#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_partner
msgid "Contact"
msgstr "Contacto"
#. module: partner_firstname
#: model:ir.model.constraint,message:partner_firstname.constraint_res_partner_check_name
msgid "Contacts require a name."
msgstr "Los contactos requieren un nombre."
#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:0
#, python-format
msgid "Error(s) with partner %d's name."
msgstr "Errores con el nombre de la empresa %d."
#. 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 "Nombre"
#. 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 "Apellido"
#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_partner__name
#: model:ir.model.fields,field_description:partner_firstname.field_res_users__name
msgid "Name"
msgstr ""
#. module: partner_firstname
#: code:addons/partner_firstname/exceptions.py:0
#, python-format
msgid "No name is set."
msgstr "No se ha establecido ningún nombre."
#. module: partner_firstname
#: model:ir.model.fields,help:partner_firstname.field_res_config_settings__partner_names_order
msgid "Order to compose partner fullname"
msgstr "Orden para generar el nombre completo"
#. module: partner_firstname
#: model_terms:ir.ui.view,arch_db:partner_firstname.res_config_settings_view_form
#, fuzzy
msgid "Partner Names Order"
msgstr "Orden de los nombres"
#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_config_settings__partner_names_order_changed
msgid "Partner Names Order Changed"
msgstr "Se ha cambiado el Orden de los Nombres"
#. module: partner_firstname
#: model:ir.model.fields,field_description:partner_firstname.field_res_config_settings__partner_names_order
msgid "Partner names order"
msgstr "Orden de los nombres"
#. module: partner_firstname
#: model_terms:ir.ui.view,arch_db:partner_firstname.res_config_settings_view_form
msgid "Recalculate names"
msgstr "Recalcular nombres"
#. module: partner_firstname
#: model_terms:ir.ui.view,arch_db:partner_firstname.res_config_settings_view_form
msgid ""
"Recalculate names for all partners. This process could take so much time if "
"there are more than 10,000 active partners"
msgstr ""
"Recalcular todos los nombres. Este proceso puede tardar si se tienen más de "
"10.000 personas asociadas"
#. module: partner_firstname
#: model:ir.model,name:partner_firstname.model_res_users
msgid "Users"
msgstr "Usuarios"

View File

@@ -0,0 +1,2 @@
from . import res_partner
from . import pms_checkin_partner

View File

@@ -0,0 +1,35 @@
from odoo import api, fields, models
class PmsCheckinPartner(models.Model):
_inherit = "pms.checkin.partner"
lastname2 = fields.Char("Last Name", related="partner_id.lastname2")
birthdate_date = fields.Date("Birthdate", related="partner_id.birthdate_date")
document_number = fields.Char(
"Document Number", related="partner_id.document_number"
)
document_type = fields.Selection(
"Document Type", related="partner_id.document_type"
)
document_expedition_date = fields.Date(
"Expedition Date", related="partner_id.document_expedition_date"
)
gender = fields.Selection("Gender", related="partner_id.gender")
@api.model
def _checkin_mandatory_fields(self, depends=False):
mandatory_fields = super(PmsCheckinPartner, self)._checkin_mandatory_fields(
depends
)
mandatory_fields.extend(
[
"lastname2",
"birthdate_date",
"document_number",
"document_type",
"document_expedition_date",
"gender",
]
)
return mandatory_fields

View File

@@ -0,0 +1,22 @@
from odoo import fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
document_type = fields.Selection(
[
("D", "DNI"),
("P", "Passport"),
("C", "Driving License"),
("I", "Identification Document"),
("N", "Spanish residence permit"),
("X", "European residence permit"),
],
help="Select a valid document type",
string="Doc. type",
)
document_number = fields.Char(
string="Document number",
)
document_expedition_date = fields.Date(string="Document expedition date")

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,481 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Partner first name and last name</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="partner-first-name-and-last-name">
<h1 class="title">Partner first name and last name</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/partner-contact/tree/14.0/partner_firstname"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/partner-contact-14-0/partner-contact-14-0-partner_firstname"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/134/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module was written to extend the functionality of contacts to support
having separate last name and first name.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id3">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>You can configure some common name patterns for the inverse function
in Settings &gt; General settings:</p>
<ul class="simple">
<li>Lastname Firstname: For example Anderson Robert</li>
<li>Lastname, Firstname: For example Anderson, Robert</li>
<li>Firstname Lastname: For example Robert Anderson</li>
</ul>
<p>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.</p>
<p>You can use <em>_get_inverse_name</em> method to get lastname and firstname from a simple string
and also <em>_get_computed_name</em> to get a name form the lastname and firstname.
These methods can be overridden to change the format specified above.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
<p>The field <em>name</em> becomes a stored function field concatenating the <em>last name</em>
and the <em>first name</em>. This avoids breaking compatibility with other modules.</p>
<p>Users should fulfill manually the separate fields for <em>last name</em> and <em>first
name</em>, but in case you edit just the <em>name</em> field in some unexpected module,
there is an inverse function that tries to split that automatically. It assumes
that you write the <em>name</em> in format configured (<em>“Lastname Firstname”</em>, by default),
but it could lead to wrong splitting (because its just blindly trying to
guess what you meant), so you better specify it manually.</p>
<p>For the same reason, after installing, previous names for contacts will stay in
the <em>name</em> field, and the first time you edit any of them you will be asked to
supply the <em>last name</em> and <em>first name</em> (just once per contact).</p>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id3">Known issues / Roadmap</a></h1>
<p>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 <a class="reference external" href="https://github.com/OCA/partner-contact/issues/210">this OCA issue</a></p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/partner-contact/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_firstname%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id5">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id6">Authors</a></h2>
<ul class="simple">
<li>Camptocamp</li>
<li>Grupo ESOC Ingeniería de Servicios</li>
<li>Tecnativa</li>
<li>LasLabs</li>
<li>ACSONE SA/NV</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id7">Contributors</a></h2>
<ul class="simple">
<li>Nicolas Bessi &lt;<a class="reference external" href="mailto:nicolas.bessi&#64;camptocamp.com">nicolas.bessi&#64;camptocamp.com</a>&gt;</li>
<li>Yannick Vaucher &lt;<a class="reference external" href="mailto:yannick.vaucher&#64;camptocamp.com">yannick.vaucher&#64;camptocamp.com</a>&gt;</li>
<li>Vincent Renaville &lt;<a class="reference external" href="mailto:vincent.renaville&#64;camptocamp.com">vincent.renaville&#64;camptocamp.com</a>&gt;</li>
<li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li>
<li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;terp.nl">hbrunn&#64;terp.nl</a>&gt;</li>
<li>Jonathan Nemry &lt;<a class="reference external" href="mailto:jonathan.nemry&#64;acsone.eu">jonathan.nemry&#64;acsone.eu</a>&gt;</li>
<li>Olivier Laurent &lt;<a class="reference external" href="mailto:olivier.laurent&#64;acsone.eu">olivier.laurent&#64;acsone.eu</a>&gt;</li>
<li>Sandy Carter &lt;<a class="reference external" href="mailto:sandy.carter&#64;savoirfairelinux.com">sandy.carter&#64;savoirfairelinux.com</a>&gt;</li>
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.fr">alexis.delattre&#64;akretion.fr</a>&gt;</li>
<li>Lorenzo Battistini &lt;<a class="reference external" href="mailto:lorenzo.battistini&#64;agilebg.com">lorenzo.battistini&#64;agilebg.com</a>&gt;</li>
<li>Hans Henrik Gabelgaard &lt;<a class="reference external" href="mailto:hhg&#64;gabelgaard.org">hhg&#64;gabelgaard.org</a>&gt;</li>
<li>Jairo Llopis &lt;<a class="reference external" href="mailto:j.llopis&#64;grupoesoc.es">j.llopis&#64;grupoesoc.es</a>&gt;</li>
<li>Adrien Peiffer &lt;<a class="reference external" href="mailto:adrien.peiffer&#64;acsone.eu">adrien.peiffer&#64;acsone.eu</a>&gt;</li>
<li>Ronald Portier &lt;<a class="reference external" href="mailto:ronald&#64;therp.nl">ronald&#64;therp.nl</a>&gt;</li>
<li>Sylvain Van Hoof</li>
<li>Pedro Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;serviciosbaeza.com">pedro.baeza&#64;serviciosbaeza.com</a>&gt;</li>
<li>Dave Lasley &lt;<a class="reference external" href="mailto:dave&#64;laslabs.com">dave&#64;laslabs.com</a>&gt;</li>
<li>Graeme Gellatly &lt;<a class="reference external" href="mailto:graeme&#64;o4sb.com">graeme&#64;o4sb.com</a>&gt;</li>
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/14.0/partner_firstname">OCA/partner-contact</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1 @@
from . import test_partner

View File

@@ -0,0 +1,124 @@
import datetime
from freezegun import freeze_time
from odoo import fields
from odoo.exceptions import ValidationError
from odoo.tests import common
@freeze_time("2011-03-16")
class TestResPartner(common.SavepointCase):
def test_check_reservation_draft_state(self):
# arrange
partner = self.env["res.partner"].create(
{
"name": "partner1",
}
)
reservation_vals = {
"checkin": "2011-03-16",
"checkout": "2011-03-19",
"partner_id": partner.id,
"adults": 1,
}
# action
reservation = self.env["pms.reservation"].create(reservation_vals)
# assert
self.assertEqual(reservation.state, "draf", "partner's fields weren't checked")
def test_check_precheckin_state(self):
# arrange
today = fields.date.today()
partner = self.env["res.partner"].create(
{
"name": "name1",
#"lastname": "lastname1",
"lastname2": "secondlastname",
"expedition_name": "2011-02-20",
"birthdate": "1995-12-10",
"gender": "M",
}
)
reservation_vals = {
"checkin": today,
"checkout": today + datetime.timedelta(days=3),
"partner_id": partner.id,
"adults": 1,
}
# action
reservation = self.env["pms.reservation"].create(reservation_vals)
checkin = self.env["pms_checkin_partner"].create(
{
"partner_id": partner.id,
"reservation_id": reservation.id,
}
)
# assert
self.assertEqual(
checkin.state, "precheckin", "partner's fields weren't checked"
)
def test_error_action_on_board(self):
today = fields.date.today()
# arrange
partner = self.env["res.partner"].create(
{
"name": "partner1",
}
)
reservation_vals = {
"checkin": today,
"checkout": today + datetime.timedelta(days=3),
"partner_id": partner.id,
"adults": 1,
}
# action
reservation = self.env["pms.reservation"].create(reservation_vals)
checkin = self.env["pms_checkin_partner"].create(
{
"partner_id": partner.id,
"reservation_id": reservation.id,
}
)
# arrange
with self.assertRaises(ValidationError):
checkin.action_on_board()
def test_right_action_on_board(self):
# arrange
# arrange
today = fields.date.today()
partner = self.env["res.partner"].create(
{
"name": "name1",
#"lastname": "lastname1",
"lastname2": "secondlastname",
"expedition_name": "2011-02-20",
"birthdate": "1995-12-10",
"gender": "M",
}
)
reservation_vals = {
"checkin": today(),
"checkout": today() + datetime.timedelta(days=3),
"partner_id": partner.id,
"adults": 1,
}
# action
reservation = self.env["pms.reservation"].create(reservation_vals)
checkin = self.env["pms_checkin_partner"].create(
{
"partner_id": partner.id,
"reservation_id": reservation.id,
}
)
# arrange
self.assertEqual(reservation.state, "onboard", "reservation's state is wrong")
self.assertEqual(checkin.state, "onboard", "checkin's state is wrong")

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="pms_checkin_partner_view_form" model="ir.ui.view">
<field name="name">Checkin partner view form Spain</field>
<field name="model">pms.checkin.partner</field>
<field name="inherit_id" ref="pms.pms_checkin_partner_view_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="lastname2" />
<field name="gender" />
<field name="birthdate_date" />
<field name="document_type" />
<field name="document_number" />
<field name="document_expedition_date" />
</xpath>
</data>
</field>
</record>
<record id="pms_checkin_partner_reservation_view_tree" model="ir.ui.view">
<field name="name">Checkin partner view reservation tree Spain</field>
<field name="model">pms.checkin.partner</field>
<field name="inherit_id" ref="pms.pms_checkin_partner_reservation_view_tree" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="lastname2" />
<field name="gender" />
<field name="birthdate_date" />
<field name="document_type" />
<field name="document_number" />
<field name="document_expedition_date" />
</xpath>
</data>
</field>
</record>
<record id="pms_checkin_partner_view_tree" model="ir.ui.view">
<field name="name">Checkin partner view tree Spain</field>
<field name="model">pms.checkin.partner</field>
<field name="inherit_id" ref="pms.pms_checkin_partner_view_tree" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="lastname2" />
<field name="gender" />
<field name="birthdate_date" />
<field name="document_type" />
<field name="document_number" />
<field name="document_expedition_date" />
</xpath>
</data>
</field>
</record>
<record id="pms_checkin_partner_view_search" model="ir.ui.view">
<field name="name">Checkin partner view tree Spain</field>
<field name="model">pms.checkin.partner</field>
<field name="inherit_id" ref="pms.pms_checkin_partner_view_search" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="lastname2" />
<field name="gender" />
<field name="birthdate_date" />
<field name="document_type" />
<field name="document_number" />
<field name="document_expedition_date" />
</xpath>
</data>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_partner_pms_l10n_es" model="ir.ui.view">
<field name="name">Legal Spanish information</field>
<field name="model">res.partner</field>
<field
name="inherit_id"
ref="partner_contact_personal_information_page.personal_information"
/>
<field name="arch" type="xml">
<xpath expr="//group[@name='personal_information_group']" position="inside">
<field name='document_type' />
<field name='document_number' />
<field name='document_expedition_date' />
</xpath>
</field>
</record>
</odoo>

View File

@@ -76,6 +76,7 @@
</tree>
</field>
</record>
<record id="pms_checkin_partner_view_tree" model="ir.ui.view">
<field name="name">pms.checkin.partner.view.tree</field>
<field name="model">pms.checkin.partner</field>

View File

@@ -0,0 +1 @@
../../../../pms-l10n-es

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)