Skip to content

Comments

[18.0][ADD] product_packaging_template: New module. Allow to configure packaging at product.template level#2133

Open
marielejeune wants to merge 1 commit intoOCA:18.0from
acsone:18.0-add-product_packaging_template
Open

[18.0][ADD] product_packaging_template: New module. Allow to configure packaging at product.template level#2133
marielejeune wants to merge 1 commit intoOCA:18.0from
acsone:18.0-add-product_packaging_template

Conversation

@marielejeune
Copy link
Contributor

Product packaging are defined at product variant level. It means that if
a product template has 25 variants, and all of them are sold in the same
packaging, one must define all the product.packaging one by one on the
variants.

The aim of this module is to be able to define the product.packaging at
template level. It will then create the product.packaging on all
variants automatically.

@marielejeune marielejeune changed the title [18.0][ADD] product_packaging_template: allow to configure packaging at product.template level [18.0][ADD] product_packaging_template: New module. Allow to configure packaging at product.template level Nov 13, 2025
@marielejeune marielejeune force-pushed the 18.0-add-product_packaging_template branch 2 times, most recently from 8443314 to 4eeb34f Compare November 13, 2025 15:20
@rousseldenis rousseldenis added this to the 18.0 milestone Nov 19, 2025
has 25 variants, and all of them are sold in the same packaging, one must define all the product.packaging
one by one on the variants.

The aim of this module is to be able to define the product.packaging at template level.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is not convenient to use technical names here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@acsonefho acsonefho left a comment

Choose a reason for hiding this comment

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

Minor changes!
Good job 💪

<field name="category_id" ref="base.module_category_hidden" />
<field
name="implied_ids"
eval="[(6, 0, [ref('product.group_stock_packaging')])]"
Copy link
Contributor

Choose a reason for hiding this comment

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

Command.xx(...)
(same for next line)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

"attribute_id": cls.attribute_color.id,
"value_ids": [
(
6,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here with Command.xxx(...) (many times in this test file).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Propagate changes on packages at variant level.
"""
res = super().write(vals)
values_to_propagate = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe extract these following lines into a dedicated function (that could help for project's modules).

def write(self, vals):
    ...
    self._propagate_to_packagings(vals)
    ...
...
def _propagate_to_packagings(self, vals):
    values_to_propagate = {
        key: vals[key] for key in {"name", "sequence", "qty"} if key in vals
    }
    if values_to_propagate:
        self.mapped("packaging_ids").write(values_to_propagate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@marielejeune marielejeune force-pushed the 18.0-add-product_packaging_template branch from 4eeb34f to b61eb8a Compare November 19, 2025 15:38
@marielejeune marielejeune force-pushed the 18.0-add-product_packaging_template branch 2 times, most recently from 7cc1885 to 40c75d2 Compare November 21, 2025 14:07
@marielejeune marielejeune force-pushed the 18.0-add-product_packaging_template branch from 40c75d2 to 542fa3c Compare November 25, 2025 10:32
@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). 🤖

@yvaucher
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 18.0-ocabot-merge-pr-2133-by-yvaucher-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Feb 12, 2026
Signed-off-by yvaucher
@OCA-git-bot
Copy link
Contributor

@yvaucher your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-2133-by-yvaucher-bump-nobump.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

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.

5 participants