Skip to content

[19.0] [MIG] sale_product_pack : migrate to 19.0#244

Open
FrancoMaxime wants to merge 91 commits intoOCA:19.0from
acsone:19.0-mig-sale_product_pack
Open

[19.0] [MIG] sale_product_pack : migrate to 19.0#244
FrancoMaxime wants to merge 91 commits intoOCA:19.0from
acsone:19.0-mig-sale_product_pack

Conversation

@FrancoMaxime
Copy link
Member

Its the same migration as #225
But taking into account the remark of @pedrobaeza and @ivantodorovich

ernestotejeda and others added 30 commits October 16, 2025 17:32
add a Roadmap section to the readme for creating sale_stock_product_pack
If not done this way, we can experiment ORM problems with cache misses.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-12.0/product-pack-12.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-12-0/product-pack-12-0-sale_product_pack/
…ame place

Previous technique was trying to access `pack_parent_line_id` related values that are
not set due to the mangling on virtual records/creation phase, provoking an ORM error,
but there's no need of such complex code, as we only need to set price_unit to 0 when
preparing vals without the need of overriding other methods.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-12.0/product-pack-12.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-12-0/product-pack-12-0-sale_product_pack/
Translated using Weblate (Spanish)

Currently translated at 86.7% (13 of 15 strings)

Translation: product-pack-12.0/product-pack-12.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-12-0/product-pack-12-0-sale_product_pack/es/
[UPD] Update sale_product_pack.pot

sale_product_pack 12.0.1.0.2

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-12.0/product-pack-12.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-12-0/product-pack-12-0-sale_product_pack/
It's helpfull to know directly if the sale order line is editable.

If the sale order is edited from an api, onchange are not always triggered
so having this field helps to raise an error.

And it can be used to display in the view that the line is not editable.
[UPD] README.rst

sale_product_pack 12.0.1.1.0

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-12.0/product-pack-12.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-12-0/product-pack-12-0-sale_product_pack/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-13.0/product-pack-13.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-13-0/product-pack-13-0-sale_product_pack/
Currently translated at 42.1% (8 of 19 strings)

Translation: product-pack-13.0/product-pack-13.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-13-0/product-pack-13-0-sale_product_pack/nl/
Compatibility module between sale_product_pack and website_sale

TT30385
oca-ci and others added 23 commits October 16, 2025 17:32
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-17.0/product-pack-17.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-17-0/product-pack-17-0-sale_product_pack/
Adapt the module sale_product_pack to the price refactor
Resolves an issue in the "Update Prices" action for packs.
When update the pricelist, ignore all the "cero" lines, this
is the components of packs "Detailed: Totalized in main product" or
"Detailed - Ignored".

We only want to update component lines if the parent pack is
"Detailed - Detailed per component".

Also keep in the so line the component discount settled in the parent
pack settings.

Steps to replicate the bug:
1. In a Sale Order add a product "Detailed - Detailed per component"
2. Save to see all the pack components
3. Change the pricelist to one with discount
4. Call the button action "Update Prices".

Before this commit The price of the parent product gets updated,
but the component prices remain unchanged. Even if the same product is
added again (while retaining the first instance), the component prices
show discrepancies.

Now, when a pricelist with discounts is applied, all line items in the
Sale Order including both parent and component products are updated
accordingly.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-17.0/product-pack-17.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-17-0/product-pack-17-0-sale_product_pack/
Currently translated at 100.0% (21 of 21 strings)

Translation: product-pack-17.0/product-pack-17.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-17-0/product-pack-17-0-sale_product_pack/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-pack-18.0/product-pack-18.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-18-0/product-pack-18-0-sale_product_pack/
The discount formula for detailed packs has been updated to address inconsistencies when pricelists explicitly display discounts.

The new formula ensures accurate representation of the combined discount by correctly factoring in both the parent pack and component discounts.

Example:

Parent pack discount: 5%
Component A discount: 10%
Component B discount: 20%
The issue occurred when pricelists explicitly displayed discounts. For example, when the pricelist showed the discount percentage but did not properly calculate the combined effect of the pack discount and the component discounts, the displayed total was inconsistent.

With the new formula:

Component A effective discount:
100.0 - ((100.0 - 5.0) * (100.0 - 10.0) / 100.0) = 14.5%
Component B effective discount:
100.0 - ((100.0 - 5.0) * (100.0 - 20.0) / 100.0) = 24.0%
This ensures that when pricelists explicitly show discounts, the displayed percentage matches the calculated prices.
Currently translated at 100.0% (21 of 21 strings)

Translation: product-pack-18.0/product-pack-18.0-sale_product_pack
Translate-URL: https://translation.odoo-community.org/projects/product-pack-18-0/product-pack-18-0-sale_product_pack/it/
…mo data for tests + simplification

Demo data can make tests to fail in integration environments or locally
modified ones, so let's remove them and use data created on the test
itself.

We also improve the containerization of the elements of the tests.

In the same movement, we have simplified the code of the test for doing
the same with less lines and in a clearer way, and change old
maintainer.
@FrancoMaxime FrancoMaxime force-pushed the 19.0-mig-sale_product_pack branch from 5cfa9b7 to 473d9b2 Compare March 12, 2026 13:18
@pedrobaeza
Copy link
Member

/ocabot migration sale_product_pack

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Mar 12, 2026
@OCA-git-bot OCA-git-bot mentioned this pull request Mar 12, 2026
6 tasks
@@ -25,7 +25,6 @@ def get_sale_order_line_vals(self, line, order):
"product_uom_qty": quantity,
}
sol = line.new(line_vals)
Copy link
Member

Choose a reason for hiding this comment

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

As now all the fields are computed writable, this technique is not needed anymore, and lines can be created with the minimum data in the dictionary, so please switch to this new approach.

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.