Skip to content

[16.0][IMP] product_packaging_unece: cache UNECE code mapping#271

Open
sbejaoui wants to merge 1 commit into
OCA:16.0from
acsone:16.0-product_packaging_unece-sbj
Open

[16.0][IMP] product_packaging_unece: cache UNECE code mapping#271
sbejaoui wants to merge 1 commit into
OCA:16.0from
acsone:16.0-product_packaging_unece-sbj

Conversation

@sbejaoui
Copy link
Copy Markdown
Contributor

add an ormcache based helper to map UNECE codes to packaging level

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @jbaudoux,
some modules you are maintaining are being modified, check this out!

@sbejaoui
Copy link
Copy Markdown
Contributor Author

cc/ @lmignon

add an ormcache based helper to map UNECE codes to packaging level
@sbejaoui sbejaoui force-pushed the 16.0-product_packaging_unece-sbj branch from ff15a1e to 5457412 Compare March 25, 2026 11:24
@rrebollo
Copy link
Copy Markdown

@sbejaoui please prefix the PR title with "[16.0]"

@lmignon lmignon changed the title [IMP] product_packaging_unece: cache UNECE code mapping [16.0][IMP] product_packaging_unece: cache UNECE code mapping May 11, 2026
res[unece_type.code].append(level.id)
return res

def get_packaging_level_ids_by_unece_code(self, *unece_codes):
Copy link
Copy Markdown

@lmignon lmignon May 11, 2026

Choose a reason for hiding this comment

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

@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}

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.

5 participants