Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] product_pack: include pack price in totalized #164

Closed
wants to merge 8 commits into from

Conversation

bruno-zanotti
Copy link
Contributor

This PR continues the refactor: #149

@OCA-git-bot
Copy link
Contributor

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

bruno-zanotti and others added 7 commits May 15, 2024 12:34
This commit improves the way the price of the packs is computed to
ensure it aligns with the behavior of normal products in Odoo.

Key improvements include:

1. Refactor Pack Price Computation:

Removed the inheritance from price_compute in favor of a clearer and
more comprehensible _get_product_price method within the Pricelist class

2. 'get_price' -> '_get_pack_line_price':

The get_price method on pack lines has been improved and renamed to
_get_pack_line_price. It is now capable of returning the price of the
 pack line for a specified pricelist.

3. List Price Calculation:

Enhanced the _compute_product_lst_price method to return the list price
of a pack. It now leverages a new method analogous to price_compute,
named _pack_line_price_compute, which can determine the prices of pack
components, including nested packs.
Packs totalized and non-detailed ignores the product pack list price
when computing the price.

This commit is a hack to keep the behavior of the modules before
this refactor.

More information in the issue OCA#169.
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.
After the refactor is not necessary to inherit the method price_compute.
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 15, 2024
@github-actions github-actions bot closed this Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants