Skip to content

[16.0][ADD] account_edi_ubl_move_line_uom_and_packaging_unece#1311

Open
sbejaoui wants to merge 2 commits into
OCA:16.0from
acsone:16.0-account_edi_ubl_move_line_packaging-sbj
Open

[16.0][ADD] account_edi_ubl_move_line_uom_and_packaging_unece#1311
sbejaoui wants to merge 2 commits into
OCA:16.0from
acsone:16.0-account_edi_ubl_move_line_packaging-sbj

Conversation

@sbejaoui
Copy link
Copy Markdown

@sbejaoui sbejaoui commented Mar 18, 2026

Adds support for UNECE unit codes during UBL invoice import to automatically detect and assign the appropriate unit of measure or product packaging on invoice lines.

When a UNECE code matches a product packaging, the packaging is set with priority. Otherwise, the corresponding unit of measure is applied based on the UNECE code.

needs:

@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch 4 times, most recently from 6de7871 to 7ce6cb5 Compare March 18, 2026 12:20
Copy link
Copy Markdown
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

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

There are plenty of unece codes for a pallet. You need m2m between packaging level and unece codes to be able to match a level based on the given unece code in the bill.

@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch from 7ce6cb5 to 2725147 Compare March 23, 2026 12:46
Copy link
Copy Markdown
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

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

As discussed. When packaging codes are used as unit code, they are prefixed by "X"

@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch from 2725147 to a931476 Compare March 24, 2026 11:13
@sbejaoui sbejaoui requested a review from jbaudoux March 24, 2026 11:16
Copy link
Copy Markdown
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

@sbejaoui Is-it a misunderstanding on my side or the way you detect the packaging is not the right one?

@lmignon
Copy link
Copy Markdown
Contributor

lmignon commented Mar 24, 2026

OCA/community-data-files#268 is merged

@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch from a931476 to 6781bfb Compare March 24, 2026 13:10
Copy link
Copy Markdown
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

see my last comment

@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch 2 times, most recently from d7afbe2 to fd9cd34 Compare March 25, 2026 09:26
@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch from f7f604d to 473b366 Compare March 25, 2026 10:06
@sbejaoui sbejaoui requested a review from lmignon March 25, 2026 10:07
Copy link
Copy Markdown
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

2 files seem missing 😏

Comment on lines +37 to +39
packaging_level_ids = pl_model._get_packaging_level_ids_by_unece_code(
unit_code
) + pl_model._get_packaging_level_ids_by_unece_code(unit_code.lstrip("X"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
packaging_level_ids = pl_model._get_packaging_level_ids_by_unece_code(
unit_code
) + pl_model._get_packaging_level_ids_by_unece_code(unit_code.lstrip("X"))
packaging_level_ids = pl_model._get_packaging_level_ids_by_unece_code(
unit_code
) if not unit_code.startswith("X") else pl_model._get_packaging_level_ids_by_unece_code(unit_code.lstrip("X"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

or simply :)

Suggested change
packaging_level_ids = pl_model._get_packaging_level_ids_by_unece_code(
unit_code
) + pl_model._get_packaging_level_ids_by_unece_code(unit_code.lstrip("X"))
packaging_level_ids = pl_model._get_packaging_level_ids_by_unece_code(unit_code.lstrip("X"))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We should search for both, since some packaging codes already start with X. The X prefix is a convention, not a rule, so we can't assume all suppliers will follow it

image

check now

https://github.com/acsone/edi/blob/b010f6eddedb3a772e2021a810406c016f8038cf/account_edi_ubl_move_line_uom_and_packaging_unece/models/account_edi_xml_ubl_20.py#L36-L40

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes but the unit code never starts with X. So it should work, like you did with this final version

@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch from 473b366 to b010f6e Compare March 25, 2026 11:45
@sbejaoui sbejaoui requested a review from lmignon March 25, 2026 11:47
@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch 3 times, most recently from 6049461 to 19891ea Compare April 14, 2026 13:22
@OCA-git-bot OCA-git-bot added mod:account_edi_ubl_move_line_uom_and_packag b7140 Module account_edi_ubl_move_line_uom_and_packaging_unece series:16.0 labels Apr 14, 2026
@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch from 19891ea to 2778aeb Compare April 14, 2026 13:40
Adds support for UNECE unit codes during UBL invoice import to automatically detect and
assign the appropriate unit of measure or product packaging on invoice lines.

When a UNECE code matches a product packaging, the packaging is set with priority.
Otherwise, the corresponding unit of measure is applied based on the UNECE code.
@sbejaoui sbejaoui force-pushed the 16.0-account_edi_ubl_move_line_packaging-sbj branch from 2778aeb to 7eacd65 Compare April 22, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved mod:account_edi_ubl_move_line_uom_and_packag b7140 Module account_edi_ubl_move_line_uom_and_packaging_unece series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants