Pedro M. Baeza
8 years ago
committed by
Jordi Ballester
12 changed files with 162 additions and 289 deletions
-
15partner_second_lastname/README.rst
-
16partner_second_lastname/__manifest__.py
-
58partner_second_lastname/i18n/es.po
-
63partner_second_lastname/i18n/partner_second_lastname.pot
-
2partner_second_lastname/models/base_config_settings.py
-
29partner_second_lastname/models/res_partner.py
-
7partner_second_lastname/tests/__init__.py
-
35partner_second_lastname/tests/test_config.py
-
4partner_second_lastname/tests/test_name.py
-
3partner_second_lastname/tests/test_onchange.py
-
157partner_second_lastname/views/res_partner.xml
-
62partner_second_lastname/views/res_user.xml
@ -1,24 +1,24 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis |
||||
|
# Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa |
||||
|
# Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. |
|
||||
|
|
||||
{ |
{ |
||||
"name": "Partner second last name", |
"name": "Partner second last name", |
||||
"summary": "Have split first and second lastnames", |
"summary": "Have split first and second lastnames", |
||||
"version": "8.0.4.1.0", |
|
||||
|
"version": "10.0.1.0.0", |
||||
"license": "AGPL-3", |
"license": "AGPL-3", |
||||
"website": "https://grupoesoc.es", |
|
||||
"author": "Grupo ESOC Ingeniería de Servicios, " |
|
||||
|
"website": "https://www.tecnativa.com", |
||||
|
"author": "Tecnativa, " |
||||
"Odoo Community Association (OCA)", |
"Odoo Community Association (OCA)", |
||||
"maintainer": "Odoo Community Association (OCA)", |
|
||||
"category": "Extra Tools", |
|
||||
|
"category": "Partner Management", |
||||
"depends": [ |
"depends": [ |
||||
"partner_firstname" |
|
||||
|
"partner_firstname", |
||||
], |
], |
||||
"data": [ |
"data": [ |
||||
"views/res_partner.xml", |
"views/res_partner.xml", |
||||
"views/res_user.xml", |
"views/res_user.xml", |
||||
], |
], |
||||
"installable": True, |
"installable": True, |
||||
'images': [], |
|
||||
} |
} |
@ -1,63 +0,0 @@ |
|||||
# Translation of Odoo Server. |
|
||||
# This file contains the translation of the following modules: |
|
||||
# * partner_second_lastname |
|
||||
# |
|
||||
msgid "" |
|
||||
msgstr "" |
|
||||
"Project-Id-Version: Odoo Server 8.0-20150811\n" |
|
||||
"Report-Msgid-Bugs-To: \n" |
|
||||
"POT-Creation-Date: 2015-08-13 09:15+0000\n" |
|
||||
"PO-Revision-Date: 2015-08-13 09:15+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: partner_second_lastname |
|
||||
#: model:ir.model,name:partner_second_lastname.model_res_partner |
|
||||
msgid "Partner" |
|
||||
msgstr "" |
|
||||
|
|
||||
#. module: partner_second_lastname |
|
||||
#: field:res.partner,lastname2:0 |
|
||||
msgid "Second last name" |
|
||||
msgstr "" |
|
||||
|
|
||||
#. module: partner_second_lastname |
|
||||
#: view:res.partner:partner_second_lastname.partner_form |
|
||||
#: view:res.partner:partner_second_lastname.partner_simple_form |
|
||||
msgid "{\n" |
|
||||
" 'required': [('firstname', '=', False),\n" |
|
||||
" ('lastname2', '=', False),\n" |
|
||||
" ('is_company', '=', False)]\n" |
|
||||
" }" |
|
||||
msgstr "" |
|
||||
|
|
||||
#. module: partner_second_lastname |
|
||||
#: view:res.users:partner_second_lastname.users_form |
|
||||
msgid "{\n" |
|
||||
" 'required': [('firstname', '=', False),\n" |
|
||||
" ('lastname2', '=', False)]\n" |
|
||||
" }" |
|
||||
msgstr "" |
|
||||
|
|
||||
#. module: partner_second_lastname |
|
||||
#: view:res.partner:partner_second_lastname.partner_form |
|
||||
#: view:res.partner:partner_second_lastname.partner_simple_form |
|
||||
msgid "{\n" |
|
||||
" 'required': [('lastname', '=', False),\n" |
|
||||
" ('lastname2', '=', False),\n" |
|
||||
" ('is_company', '=', False)]\n" |
|
||||
" }" |
|
||||
msgstr "" |
|
||||
|
|
||||
#. module: partner_second_lastname |
|
||||
#: view:res.users:partner_second_lastname.users_form |
|
||||
msgid "{\n" |
|
||||
" 'required': [('lastname', '=', False),\n" |
|
||||
" ('lastname2', '=', False)]\n" |
|
||||
" }" |
|
||||
msgstr "" |
|
||||
|
|
@ -1,6 +1,7 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. |
|
||||
|
|
||||
from . import test_name, test_onchange |
|
||||
from openerp.addons.partner_firstname.tests import test_empty |
|
||||
|
from . import test_name |
||||
|
from . import test_onchange |
||||
|
from . import test_config |
||||
|
from odoo.addons.partner_firstname.tests import test_empty |
@ -0,0 +1,35 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from odoo.tests import common |
||||
|
|
||||
|
|
||||
|
class TestConfig(common.SavepointCase): |
||||
|
@classmethod |
||||
|
def setUpClass(cls): |
||||
|
super(TestConfig, cls).setUpClass() |
||||
|
cls.wizard = cls.env['base.config.settings'].create({}) |
||||
|
cls.partner = cls.env['res.partner'].create({ |
||||
|
'firstname': "First", |
||||
|
'lastname': "Last", |
||||
|
'lastname2': "Second", |
||||
|
}) |
||||
|
|
||||
|
def test_last_first(self): |
||||
|
self.wizard.partner_names_order = 'last_first' |
||||
|
self.wizard.set_partner_names_order() |
||||
|
self.wizard.action_recalculate_partners_name() |
||||
|
self.assertEqual(self.partner.name, "Last Second First") |
||||
|
|
||||
|
def test_last_first_comma(self): |
||||
|
self.wizard.partner_names_order = 'last_first_comma' |
||||
|
self.wizard.set_partner_names_order() |
||||
|
self.wizard.action_recalculate_partners_name() |
||||
|
self.assertEqual(self.partner.name, "Last Second, First") |
||||
|
|
||||
|
def test_first_last(self): |
||||
|
self.wizard.partner_names_order = 'first_last' |
||||
|
self.wizard.set_partner_names_order() |
||||
|
self.wizard.action_recalculate_partners_name() |
||||
|
self.assertEqual(self.partner.name, "First Last Second") |
@ -1,105 +1,54 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
© 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. --> |
|
||||
|
|
||||
<openerp> |
|
||||
<data> |
|
||||
<record id="partner_simple_form" model="ir.ui.view"> |
|
||||
<field name="name">Add second last name</field> |
|
||||
<field name="model">res.partner</field> |
|
||||
<field name="inherit_id" |
|
||||
ref="partner_firstname.view_partner_simple_form_firstname"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<data> |
|
||||
<xpath expr="//field[@name='firstname']" position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('lastname', '=', False), |
|
||||
('lastname2', '=', False), |
|
||||
('is_company', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
|
||||
<xpath expr="//field[@name='lastname']" position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('firstname', '=', False), |
|
||||
('lastname2', '=', False), |
|
||||
('is_company', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
|
||||
<xpath expr="//field[@name='lastname']" position="after"> |
|
||||
<field name="lastname2" |
|
||||
attrs="{'required': [('firstname', '=', False), |
|
||||
('lastname', '=', False), |
|
||||
('is_company', '=', False)]}"/> |
|
||||
</xpath> |
|
||||
</data> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="partner_form" model="ir.ui.view"> |
|
||||
<field name="name">Add second last name</field> |
|
||||
<field name="model">res.partner</field> |
|
||||
<field name="inherit_id" |
|
||||
ref="partner_firstname.view_partner_form_firstname"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<data> |
|
||||
<!-- Main form --> |
|
||||
<xpath expr="//field[@name='firstname']" position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('lastname', '=', False), |
|
||||
('lastname2', '=', False), |
|
||||
('is_company', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
|
||||
<xpath expr="//field[@name='lastname']" position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('firstname', '=', False), |
|
||||
('lastname2', '=', False), |
|
||||
('is_company', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
|
||||
<xpath expr="//field[@name='lastname']" position="after"> |
|
||||
<field name="lastname2" |
|
||||
attrs="{'required': [('firstname', '=', False), |
|
||||
('lastname', '=', False), |
|
||||
('is_company', '=', False)]}"/> |
|
||||
</xpath> |
|
||||
|
|
||||
<!-- Inner contact form of child_ids --> |
|
||||
<xpath expr="//field[@name='child_ids']/form |
|
||||
//field[@name='firstname']" |
|
||||
position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('lastname', '=', False), |
|
||||
('lastname2', '=', False), |
|
||||
('is_company', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
|
||||
<xpath expr="//field[@name='child_ids']/form |
|
||||
//field[@name='lastname']" |
|
||||
position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('firstname', '=', False), |
|
||||
('lastname2', '=', False), |
|
||||
('is_company', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
|
||||
<xpath expr="//field[@name='child_ids']/form |
|
||||
//field[@name='lastname']" |
|
||||
position="after"> |
|
||||
<field name="lastname2" |
|
||||
attrs="{'required': [('firstname', '=', False), |
|
||||
('lastname', '=', False), |
|
||||
('is_company', '=', False)]}"/> |
|
||||
</xpath> |
|
||||
</data> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
||||
|
<!-- Copyright 2015 Tecnativa - Jairo Llopis |
||||
|
Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
||||
|
<odoo> |
||||
|
<record id="partner_simple_form" model="ir.ui.view"> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="partner_firstname.view_partner_simple_form_firstname"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<data> |
||||
|
<xpath expr="//field[@name='firstname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='lastname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='lastname']" position="after"> |
||||
|
<field name="lastname2" attrs="{'required': [('firstname', '=', False), ('lastname', '=', False), ('is_company', '=', False)]}"/> |
||||
|
</xpath> |
||||
|
</data> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="partner_form" model="ir.ui.view"> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="partner_firstname.view_partner_form_firstname"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<data> |
||||
|
<!-- Main form --> |
||||
|
<xpath expr="//field[@name='firstname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
|
||||
|
<xpath expr="//field[@name='lastname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='lastname']" position="after"> |
||||
|
<field name="lastname2" attrs="{'required': [('firstname', '=', False), ('lastname', '=', False), ('is_company', '=', False)]}"/> |
||||
|
</xpath> |
||||
|
<!-- Inner contact form of child_ids --> |
||||
|
<xpath expr="//field[@name='child_ids']/form//field[@name='firstname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='child_ids']/form//field[@name='lastname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='child_ids']/form//field[@name='lastname']" position="after"> |
||||
|
<field name="lastname2" attrs="{'required': [('firstname', '=', False), ('lastname', '=', False), ('is_company', '=', False)]}"/> |
||||
|
</xpath> |
||||
|
</data> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -1,42 +1,30 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
© 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. --> |
|
||||
|
<!-- Copyright 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis |
||||
|
Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
||||
|
<odoo> |
||||
|
|
||||
<openerp> |
|
||||
<data> |
|
||||
|
<record id="users_form" model="ir.ui.view"> |
||||
|
<field name="name">Add second last name</field> |
||||
|
<field name="model">res.users</field> |
||||
|
<field name="inherit_id" ref="partner_firstname.view_users_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<data> |
||||
|
<xpath expr="//field[@name='firstname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('lastname', '=', False), ('lastname2', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
|
||||
<!-- Required before modifying `base.vew_users_form`. |
|
||||
https://github.com/odoo/odoo/issues/6324#issuecomment-93534579 --> |
|
||||
<function model="res.groups" name="update_user_groups_view" /> |
|
||||
|
<xpath expr="//field[@name='lastname']" position="attributes"> |
||||
|
<attribute name="attrs">{'required': [('firstname', '=', False), ('lastname2', '=', False)]}</attribute> |
||||
|
</xpath> |
||||
|
|
||||
<record id="users_form" model="ir.ui.view"> |
|
||||
<field name="name">Add second last name</field> |
|
||||
<field name="model">res.users</field> |
|
||||
<field name="inherit_id" ref="partner_firstname.view_users_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<data> |
|
||||
<xpath expr="//field[@name='firstname']" position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('lastname', '=', False), |
|
||||
('lastname2', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
<xpath expr="//field[@name='lastname']" position="after"> |
||||
|
<field name="lastname2" |
||||
|
attrs="{'required': [('firstname', '=', False), ('lastname', '=', False)]}" |
||||
|
/> |
||||
|
</xpath> |
||||
|
</data> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
<xpath expr="//field[@name='lastname']" position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'required': [('firstname', '=', False), |
|
||||
('lastname2', '=', False)] |
|
||||
}</attribute> |
|
||||
</xpath> |
|
||||
|
|
||||
<xpath expr="//field[@name='lastname']" position="after"> |
|
||||
<field name="lastname2" |
|
||||
attrs="{'required': [('firstname', '=', False), |
|
||||
('lastname', '=', False)]}"/> |
|
||||
</xpath> |
|
||||
</data> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue