Browse Source

[FIX] don't override defaults from context

pull/550/head
Holger Brunn 7 years ago
parent
commit
360a8bd777
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 2
      partner_firstname/__manifest__.py
  2. 11
      partner_firstname/models/res_partner.py

2
partner_firstname/__manifest__.py

@ -7,7 +7,7 @@
{
'name': 'Partner first name and last name',
'summary': "Split first name and last name for non company partners",
'version': '10.0.2.1.0',
'version': '10.0.2.1.1',
'author': "Camptocamp, "
"Grupo ESOC Ingeniería de Servicios, "
"Tecnativa, "

11
partner_firstname/models/res_partner.py

@ -68,13 +68,16 @@ class ResPartner(models.Model):
"""Invert name when getting default values."""
result = super(ResPartner, self).default_get(fields_list)
if not result.get('name'):
return result
inverted = self._get_inverse_name(
self._get_whitespace_cleaned_name(result.get("name", "")),
self._get_whitespace_cleaned_name(result["name"]),
result.get("is_company", False))
for field in inverted.keys():
if field in fields_list:
result[field] = inverted.get(field)
for field in inverted:
if field in fields_list and field not in result:
result[field] = inverted[field]
return result

Loading…
Cancel
Save