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] website_sale: discount #31965

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@nim-odoo
Copy link
Contributor

nim-odoo commented Mar 20, 2019

  • Go to Sales > Configuration > Settings
  • Enable "Multiple Sales Prices per Product" and select option "Prices
    computed from formulas (discounts, margins, roundings)"
  • Go to Sales > Catalog / Pricelists
  • Select "Public Pricelist" and set "Discount Policy: Show public price
    & discount to the customer"
  • Go to the eCommerce, buy "iPad Retina Display" which as a 20 %
    discount

In the corresponding SO, the discount appears to be zero, and the
discount is included in the price unit. However, adding the product
directly to the SO in the backend displays the discount as expected.

There should not be a difference in behavior between the eCommerce and
the backend.

Fixes #31337
opw-1943989

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@nim-odoo nim-odoo self-assigned this Mar 20, 2019

@nim-odoo nim-odoo added the OE label Mar 20, 2019

@robodoo robodoo added the seen 🙂 label Mar 20, 2019

@nim-odoo nim-odoo added the Blocked label Mar 20, 2019

@robodoo robodoo added the CI 🤖 label Mar 20, 2019

@nim-odoo nim-odoo requested a review from JKE-be Mar 20, 2019

@nim-odoo

This comment has been minimized.

Copy link
Contributor Author

nim-odoo commented Mar 20, 2019

@JKE-be I'm not sure we should really do this. From my experience, we already had quite a lot of issues with discount and pricelists on the website, and I'm afraid it could cause more problems than it solves.

discount = 0

if order.pricelist_id.discount_policy == 'without_discount':
# This part is pretty much a copy-paste of the method '_onchange_discount' of

This comment has been minimized.

Copy link
@JKE-be

JKE-be Mar 20, 2019

Contributor

in this case, can we call this method instead to duplicate all this code ?

This comment has been minimized.

Copy link
@nim-odoo

nim-odoo Mar 20, 2019

Author Contributor

There is always a way to do it.

In this case, note that the SO line might not exist yet:

values = self._website_product_id_change(self.id, product_id, qty=1)
values['name'] = self._get_line_description(self.id, product_id, attributes=attributes)
order_line = SaleOrderLineSudo.create(values)

So we'd also have to refactor the onchange.

@nim-odoo nim-odoo force-pushed the odoo-dev:11.0-opw-1943989-discount-nim branch from ac44f2c to 969141f Mar 25, 2019

@robodoo robodoo removed the CI 🤖 label Mar 25, 2019

@nim-odoo nim-odoo force-pushed the odoo-dev:11.0-opw-1943989-discount-nim branch 2 times, most recently from 8c54713 to 113d8cc Mar 25, 2019

@robodoo robodoo added the CI 🤖 label Mar 25, 2019

@nim-odoo nim-odoo removed the Blocked label Mar 25, 2019

[FIX] website_sale: discount
- Go to Sales > Configuration > Settings
- Enable "Multiple Sales Prices per Product" and select option "Prices
  computed from formulas (discounts, margins, roundings)"
- Go to Sales > Catalog / Pricelists
- Select "Public Pricelist" and set "Discount Policy: Show public price
  & discount to the customer"
- Go to the eCommerce, buy "iPad Retina Display" which as a 20 %
  discount

In the corresponding SO, the discount appears to be zero, and the
discount is included in the price unit. However, adding the product
directly to the SO in the backend displays the discount as expected.

There should not be a difference in behavior between the eCommerce and
the backend.

Fixes #31337
opw-1943989

@nim-odoo nim-odoo force-pushed the odoo-dev:11.0-opw-1943989-discount-nim branch from 113d8cc to 2c4ae10 Apr 2, 2019

@robodoo robodoo removed the CI 🤖 label Apr 2, 2019

@nim-odoo

This comment has been minimized.

Copy link
Contributor Author

nim-odoo commented Apr 2, 2019

robodoo r+

robodoo pushed a commit that referenced this pull request Apr 2, 2019

[FIX] website_sale: discount
- Go to Sales > Configuration > Settings
- Enable "Multiple Sales Prices per Product" and select option "Prices
  computed from formulas (discounts, margins, roundings)"
- Go to Sales > Catalog / Pricelists
- Select "Public Pricelist" and set "Discount Policy: Show public price
  & discount to the customer"
- Go to the eCommerce, buy "iPad Retina Display" which as a 20 %
  discount

In the corresponding SO, the discount appears to be zero, and the
discount is included in the price unit. However, adding the product
directly to the SO in the backend displays the discount as expected.

There should not be a difference in behavior between the eCommerce and
the backend.

Fixes #31337
opw-1943989

closes #31965

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
@robodoo

This comment has been minimized.

Copy link
Contributor

robodoo commented Apr 2, 2019

Merged, thanks!

@robodoo robodoo closed this Apr 2, 2019

@nim-odoo nim-odoo deleted the odoo-dev:11.0-opw-1943989-discount-nim branch Apr 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.