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

[17.0][FIX] partner_firstname: fix error when creating a user from an employee #1725

Merged
merged 1 commit into from
Apr 18, 2024
Merged

[17.0][FIX] partner_firstname: fix error when creating a user from an employee #1725

merged 1 commit into from
Apr 18, 2024

Conversation

BurkhalterY
Copy link
Member

Steps to reproduce:

  • Install hr and partner_firstname
  • Go to Employees > any employee > action menu > Create User > Save
  • 💥 Traceback

Suspected cause: in defaul_get(), the field name is not present in fields_list (probably because it's computed). So result.get("name", "") will always return "" and firstname and lastname are not computed.

@BurkhalterY BurkhalterY changed the title [17.0][FIX] partner_firstname: fix error wehn creating a user from an employee [17.0][FIX] partner_firstname: fix error when creating a user from an employee Apr 3, 2024
Copy link
Member

@mymage mymage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK on RunBoat

Copy link

@luisDIXMIT luisDIXMIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza pedrobaeza added this to the 17.0 milestone Apr 16, 2024
@@ -65,6 +65,7 @@ def copy(self, default=None):
@api.model
def default_get(self, fields_list):
"""Invert name when getting default values."""
fields_list.append("name")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, the proper fix is to do the stuff only if name if fields_list, not to force always to include that field in the results.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pedrobaeza, I'm not sure to understand what do you propose, but I added a condition to add name only if firstname or lastname is in fields_list.
Let me know if there is a better solution

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that can work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other issue #1757

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pr for FIX #1793

Steps to reproduce:
- Install `hr` and `partner_firstname`
- Go to Employees > any employee > action menu > Create User > Save
- 💥 Traceback

Suspected cause: in `defaul_get()`, the field `name` is not present in `fields_list` (probably because it's computed). So `result.get("name", "")` will always return `""` and `firstname` and `lastname` are not computed.
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-1725-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 6172d4c into OCA:17.0 Apr 18, 2024
5 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at aa70256. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants