partner-contact/partner_multi_name/models/res_users.py
2021-11-07 03:21:43 +00:00

24 lines
954 B
Python

# 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
# Copyright 2018 EXA Auto Parts S.A.S Guillermo Montoya <Github@guillermm>
# Copyright 2018 EXA Auto Parts S.A.S Joan Marín <Github@JoanMarin>
# Copyright 2018 EXA Auto Parts S.A.S Juan Ocampo <Github@Capriatto>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from flectra import api, models
class ResUsers(models.Model):
_inherit = 'res.users'
@api.onchange("firstname", "othernames", "lastname", "lastname2")
def _compute_name(self):
"""Write the 'name' field according to splitted data."""
for partner in self:
partner.name = partner.partner_id._get_computed_name(
partner.firstname,
partner.othernames,
partner.lastname,
partner.lastname2)