diff --git a/partner_firstname/__openerp__.py b/partner_firstname/__openerp__.py index 57ad3366f..4b8d9ce9e 100644 --- a/partner_firstname/__openerp__.py +++ b/partner_firstname/__openerp__.py @@ -22,7 +22,8 @@ 'name': 'Partner first name and last name', 'summary': "Split first name and last name for non company partners", 'version': '8.0.2.0.0', - 'author': "Camptocamp,Odoo Community Association (OCA)", + 'author': "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", 'maintainer': 'Camptocamp, Acsone', 'category': 'Extra Tools', 'website': 'http://www.camptocamp.com, http://www.acsone.eu', diff --git a/partner_firstname/exceptions.py b/partner_firstname/exceptions.py index 99d5b630e..a75429514 100644 --- a/partner_firstname/exceptions.py +++ b/partner_firstname/exceptions.py @@ -1,5 +1,4 @@ -# -*- encoding: utf-8 -*- - +# -*- coding: utf-8 -*- # Odoo, Open Source Management Solution # Copyright (C) 2014-2015 Grupo ESOC # diff --git a/partner_firstname/models.py b/partner_firstname/models.py index 47f6f7e0f..346c7032e 100644 --- a/partner_firstname/models.py +++ b/partner_firstname/models.py @@ -73,7 +73,7 @@ class ResPartner(models.Model): @api.model def _get_inverse_name(self, name, is_company=False): - """Try to revert the effect of :meth:`._compute_name`. + """Compute the inverted name. - If the partner is a company, save it in the lastname. - Otherwise, make a guess. @@ -93,12 +93,13 @@ class ResPartner(models.Model): parts = name.split(" ", 1) while len(parts) < 2: parts.append(False) - return parts + return {"lastname": parts[0], "firstname": parts[1]} @api.one def _inverse_name(self): + """Try to revert the effect of :meth:`._compute_name`.""" parts = self._get_inverse_name(self.name, self.is_company) - self.lastname, self.firstname = parts + self.lastname, self.firstname = parts["lastname"], parts["firstname"] @api.one @api.constrains("firstname", "lastname") diff --git a/partner_firstname/tests/test_empty.py b/partner_firstname/tests/test_empty.py index 280ed9e92..168d987a5 100644 --- a/partner_firstname/tests/test_empty.py +++ b/partner_firstname/tests/test_empty.py @@ -1,5 +1,4 @@ -# -*- encoding: utf-8 -*- - +# -*- coding: utf-8 -*- # Odoo, Open Source Management Solution # Copyright (C) 2014-2015 Grupo ESOC #