Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] partner_firstname: fix installation w/ missing names #1678

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion partner_firstname/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@
correctly into the database. This can be called later too if needed.
"""
# Find records with empty firstname and lastname
records = self.search([("firstname", "=", False), ("lastname", "=", False)])
records = self.search(

Check warning on line 262 in partner_firstname/models/res_partner.py

View check run for this annotation

Codecov / codecov/patch

partner_firstname/models/res_partner.py#L262

Added line #L262 was not covered by tests
[("firstname", "=", False), ("lastname", "=", False), ("name", "!=", "")]
)

# Force calculations there
records._inverse_name()
Expand Down
12 changes: 12 additions & 0 deletions partner_firstname/tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@

super(PersonCase, self).tearDown()

def test_module_installation(self):
model = self.env[self.model].with_context(**self.context)
unnamed = model.create(

Check warning on line 38 in partner_firstname/tests/test_create.py

View check run for this annotation

Codecov / codecov/patch

partner_firstname/tests/test_create.py#L37-L38

Added lines #L37 - L38 were not covered by tests
{"name": "", "email": "[email protected]", "type": "invoice"}
)
named = model.create(

Check warning on line 41 in partner_firstname/tests/test_create.py

View check run for this annotation

Codecov / codecov/patch

partner_firstname/tests/test_create.py#L41

Added line #L41 was not covered by tests
{"name": "firstname lastname", "email": "[email protected]"}
)
model._install_partner_firstname()
self.assertEqual(unnamed.name, "")
self.assertEqual((named.firstname, named.lastname), ("firstname", "lastname"))

Check warning on line 46 in partner_firstname/tests/test_create.py

View check run for this annotation

Codecov / codecov/patch

partner_firstname/tests/test_create.py#L44-L46

Added lines #L44 - L46 were not covered by tests

def test_no_name(self):
"""Name is calculated."""
del self.values["name"]
Expand Down
Loading