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

[16] product_margin_classification changes template list_price instead of variant_extra_price #226

Open
FreezeS opened this issue Jan 23, 2025 · 0 comments
Labels

Comments

@FreezeS
Copy link

FreezeS commented Jan 23, 2025

Hi guys,

In the current implementation, product_margin_classification is completely unusable for products with variants that have different costs.
Changing the sale price of a variant will change the sale price of all the other variants.

How to reproduce in runboat:

  • create a new attribute "Pins", radio, dynamically. Add 3 values: 5,10,15

  • create a new product "Test1", at Attributes and Variants select Pins, add all 3 values

  • make a new sales order, select product Test1, when popup appears, select Pins - 5. Repeat to create all 3 variants.

  • go to the Test1 template, set list_price 50$.

  • click on 3 Variants, edit each and set cost the same as pins value. After it should look like this:
    Image

  • go to margin classifications, create a 33% margin like this:

Image

  • go to Inventory - Products - Product variants, select Test1 with Pins: 5 and set the margin classification

Image

  • click on Decrease price

What I expected to happen:

  • variant_extra_price to be set at -42.5 resulting in a sales price of 7.5 for the variant and the sale price of the other variants to remain unchanged

What happens:

  • list_price of the template Test1 is set to 7.5 affecting the sales price of all the other variants

Image

  • now if I go to another variant, select the same classification and set the price:

Image
This changed the price for the 5 pin version as well:

Image

Proposed fix

def use_theoretical_price(self):
        for product in self:
            product.lst_price = product.theoretical_price

should be

def use_theoretical_price(self):
        for product in self:
            product.variant_extra_price = product.theoretical_price - product.list_price

From my very limited experience, lst_price should not be edited directly as it affects the template list_price. Every modification of a variant's price should be via variant_extra_price.
Can anyone with more experience chime in?

@FreezeS FreezeS added the bug label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant