Skip to content

[MOD][18.0] hr_employee_language: languages selection#1517

Open
mymage wants to merge 1 commit intoOCA:18.0from
mymage:18.0-mod-hr_employee_language
Open

[MOD][18.0] hr_employee_language: languages selection#1517
mymage wants to merge 1 commit intoOCA:18.0from
mymage:18.0-mod-hr_employee_language

Conversation

@mymage
Copy link
Member

@mymage mymage commented Oct 16, 2025

As in #1486
Changes the source of language list moving it from the res.lang.csv file to res.lang model.
In this way if you add a language at runtime it will be immediately available.

Added _compute_display_name (ex name_get) to show language name instead language code on selection or m2o widget

@mymage mymage changed the title [MOD][17.0] hr_employee_language: languages selection [MOD][18.0] hr_employee_language: languages selection Oct 16, 2025
@mymage mymage force-pushed the 18.0-mod-hr_employee_language branch 17 times, most recently from 2d3668b to 75eca3b Compare October 16, 2025 17:57
@mymage mymage marked this pull request as ready for review October 16, 2025 17:59
@mymage
Copy link
Member Author

mymage commented Oct 16, 2025

@dreispt @primes2h @TheMule71 plase review.
Little differences from #1512

@mymage
Copy link
Member Author

mymage commented Nov 10, 2025

@dreispt Thanks for your notes; I'm not so skilled on coding so your suggestion is very appreciated. I'll give a look asap.

@mymage mymage force-pushed the 18.0-mod-hr_employee_language branch 6 times, most recently from 72cb747 to 356ce99 Compare November 15, 2025 10:16
@mymage mymage force-pushed the 18.0-mod-hr_employee_language branch 6 times, most recently from bfff99a to ab2bd18 Compare November 16, 2025 20:56
@mymage
Copy link
Member Author

mymage commented Nov 16, 2025

@dreispt Thanks to your comments I refactored the code. The only "strange" thing that I made is this:
self_data = self.env["hr.employee.language"].search([]) for record in self_data:
to have CodeCov at 100%: this because despite I create an element in hr.employee.language for test, here self is empty.

@mymage mymage force-pushed the 18.0-mod-hr_employee_language branch from ab2bd18 to 87e51ec Compare November 19, 2025 21:19
@mymage
Copy link
Member Author

mymage commented Jan 19, 2026

@dreispt @primes2h @TheMule71 ping. Thanks

1 similar comment
@mymage
Copy link
Member Author

mymage commented Feb 16, 2026

@dreispt @primes2h @TheMule71 ping. Thanks

Copy link
Contributor

@alexey-pelykh alexey-pelykh left a comment

Choose a reason for hiding this comment

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

Thanks for improving the language selection to use res.lang records. A couple of things to address:

  1. _compute_display_name() searches ALL hr.employee.language records (self.env["hr.employee.language"].search([])) instead of iterating over self. This is both a performance issue and semantically incorrect — compute methods should only set values on self records.

  2. The compute method returns a list of tuples, but Odoo compute methods don't use return values — they assign to self.display_name (which you do, but the return is dead code).

  3. Using _() on selection keys (_("%(code)s", code=lang.code)) translates the code itself, which shouldn't be translated — codes are stable identifiers.

Happy to re-review once updated.

@mymage mymage force-pushed the 18.0-mod-hr_employee_language branch 4 times, most recently from 1b03217 to c27e05b Compare March 4, 2026 20:49
@mymage mymage force-pushed the 18.0-mod-hr_employee_language branch from c27e05b to a3f5258 Compare March 4, 2026 21:02
@mymage
Copy link
Member Author

mymage commented Mar 4, 2026

Thanks @alexey-pelykh for your suggestions. I updated the code, I hope in the right way.
If this is ok I will fix the other two.

@mymage mymage requested a review from alexey-pelykh March 4, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants