Browse Source

[MIG] partner_second_lastname: Migration to 14.0

14.0
Luis Torres 4 years ago
parent
commit
b9e3ab7b2a
  1. 2
      partner_second_lastname/__manifest__.py
  2. 8
      partner_second_lastname/models/res_partner.py
  3. 42
      partner_second_lastname/views/res_partner.xml
  4. 12
      partner_second_lastname/views/res_user.xml

2
partner_second_lastname/__manifest__.py

@ -6,7 +6,7 @@
{
"name": "Partner second last name",
"summary": "Have split first and second lastnames",
"version": "13.0.2.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"website": "https://github.com/OCA/partner-contact",
"author": "Tecnativa, " "Odoo Community Association (OCA)",

8
partner_second_lastname/models/res_partner.py

@ -13,7 +13,9 @@ class ResPartner(models.Model):
_inherit = "res.partner"
lastname2 = fields.Char("Second last name",)
lastname2 = fields.Char(
"Second last name",
)
@api.model
def _get_computed_name(self, lastname, firstname, lastname2=None):
@ -47,7 +49,9 @@ class ResPartner(models.Model):
"""Write :attr:`~.name` according to splitted data."""
for partner in self:
partner.name = self._get_computed_name(
partner.lastname, partner.firstname, partner.lastname2,
partner.lastname,
partner.firstname,
partner.lastname2,
)
def _inverse_name(self):

42
partner_second_lastname/views/res_partner.xml

@ -11,14 +11,16 @@
/>
<field name="arch" type="xml">
<field name="firstname" position="attributes">
<attribute
name="attrs"
>{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
<attribute name="attrs">
{'required': [('lastname', '=', False), ('lastname2', '=', False),
('is_company', '=', False), ('type', '=', 'contact')]}
</attribute>
</field>
<field name="lastname" position="attributes">
<attribute
name="attrs"
>{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
<attribute name="attrs">
{'required': [('firstname', '=', False), ('lastname2', '=', False),
('is_company', '=', False), ('type', '=', 'contact')]}
</attribute>
</field>
<field name="lastname" position="after">
<field
@ -34,14 +36,16 @@
<field name="arch" type="xml">
<!-- Main form -->
<field name="firstname" position="attributes">
<attribute
name="attrs"
>{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
<attribute name="attrs">
{'required': [('lastname', '=', False), ('lastname2', '=', False),
('is_company', '=', False), ('type', '=', 'contact')]}
</attribute>
</field>
<field name="lastname" position="attributes">
<attribute
name="attrs"
>{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
<attribute name="attrs">
{'required': [('firstname', '=', False), ('lastname2', '=', False),
('is_company', '=', False), ('type', '=', 'contact')]}
</attribute>
</field>
<field name="lastname" position="after">
<field
@ -54,17 +58,19 @@
expr="//field[@name='child_ids']/form//field[@name='firstname']"
position="attributes"
>
<attribute
name="attrs"
>{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
<attribute name="attrs">
{'required': [('lastname', '=', False), ('lastname2', '=', False),
('is_company', '=', False), ('type', '=', 'contact')]}
</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), ('type', '=', 'contact')]}</attribute>
<attribute name="attrs">
{'required': [('firstname', '=', False), ('lastname2', '=', False),
('is_company', '=', False), ('type', '=', 'contact')]}
</attribute>
</xpath>
<xpath
expr="//field[@name='child_ids']/form//field[@name='lastname']"

12
partner_second_lastname/views/res_user.xml

@ -9,14 +9,14 @@
<field name="inherit_id" ref="partner_firstname.view_users_form" />
<field name="arch" type="xml">
<field name="firstname" position="attributes">
<attribute
name="attrs"
>{'required': [('lastname', '=', False), ('lastname2', '=', False)]}</attribute>
<attribute name="attrs">
{'required': [('lastname', '=', False), ('lastname2', '=', False)]}
</attribute>
</field>
<field name="lastname" position="attributes">
<attribute
name="attrs"
>{'required': [('firstname', '=', False), ('lastname2', '=', False)]}</attribute>
<attribute name="attrs">
{'required': [('firstname', '=', False), ('lastname2', '=', False)]}
</attribute>
</field>
<field name="lastname" position="after">
<field

Loading…
Cancel
Save