[BUG] website_sale_checkout_skip_payment not compatible with delivery methods
Closed this issue · 4 comments
Module
website_sale_checkout_skip_payment
Tested on version 12 Community Edition
Describe the bug
When buying product from eCommerce, I select a delivery method available (not the first one). On the Sale Order in backend, the wrong delivery method is selected. It's always the first one in the list of delivery methods configuration that is selected on the SO.
To Reproduce
Affected versions: version 12
Steps to reproduce the behavior:
- Install website_sale_checkout_skip_payment and website_delivery.
- Configure the customer partner so that the payment screen will be skipped
- Configure 2 delivery methods and publish them
- Go on eCommerce and buy a product. Select the second delivery method.
- Validate
- Go on SO in backend and check the delivery method: wrong method is selected.
Expected behavior
6. The delivery method chosen by the customer on the eCommerce is selected o
n the SO on the backend
The issue happens at the last step
Here, when changing the delivery method, the method _update_website_sale_delivery
should be triggered by this JS code.
But when the customer is allowed to skip_payment, the JS code throws an error at this line :
Uncaught TypeError:
``$pay_button.data(...) is undefined
_onCarrierClick http://localhost:8012/web/content/985-5287018/1/web.assets_frontend.js:295
so the method is not tiggered, the carrier is not updated, and the first one on the list is used.
I think this might be because the payment route is skipped and we go directly to the confirmation route (like below).
However I don't have a clearer idea.
@sergio-teruel Do you know a way to fix this issue ?
Sorry @victor-champonnois The website_sale_checkout_skip_payment module has not include any JS code, so I think that this error is related to other module...
@sergio-teruel I took a look and it seems to be related to the absence of the payment button element. https://github.com/odoo/odoo/blob/c53081f10befd4f1c98e46a450ed3bc71a6246ed/addons/website_sale_delivery/static/src/js/website_sale_delivery.js#L12
Anyway, I couldn't reproduce the bug in the versions we're currently supporting for our customers (>13).
So @victor-champonnois feel free to propose a PR patching de issue for 12.0
There hasn't been any activity on this issue in the past 6 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 issue to never become stale, please ask a PSC member to apply the "no stale" label.