[16.0][IMP] product_packaging_unece: cache UNECE code mapping#271
Open
sbejaoui wants to merge 1 commit into
Open
[16.0][IMP] product_packaging_unece: cache UNECE code mapping#271sbejaoui wants to merge 1 commit into
sbejaoui wants to merge 1 commit into
Conversation
Contributor
|
Hi @jbaudoux, |
Contributor
Author
|
cc/ @lmignon |
jbaudoux
approved these changes
Mar 25, 2026
add an ormcache based helper to map UNECE codes to packaging level
ff15a1e to
5457412
Compare
lmignon
approved these changes
Mar 25, 2026
|
@sbejaoui please prefix the PR title with "[16.0]" |
lmignon
requested changes
May 11, 2026
| res[unece_type.code].append(level.id) | ||
| return res | ||
|
|
||
| def get_packaging_level_ids_by_unece_code(self, *unece_codes): |
There was a problem hiding this comment.
@sbejaoui when I read x_by_y I expect to receive a dictionary.... IMO the naming or the return value is not right....
get_packaging_level_ids(*unece_codes) -> list[int]: | get_packaging_level_ids_for_codes(*unece_codes) -> list[int]:
or
def get_packaging_level_id_by_unece_code(self, *unece_codes) -> dict[str, list[int]]:
mapping = self._get_packaging_level_ids_by_unece_code()
if len(unece_codes) == 1 and isinstance(unece_codes[0], (list, tuple, set)):
unece_codes = unece_codes[0]
return {code : mapping[code] for code in unece_codes if code in mapping}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add an ormcache based helper to map UNECE codes to packaging level