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

[BUG] website_sale_checkout_skip_payment not compatible with delivery methods #741

Closed
vdewulf opened this issue Jan 27, 2023 · 4 comments
Closed
Labels
bug stale PR/Issue without recent activity, it'll be soon closed automatically.

Comments

@vdewulf
Copy link

vdewulf commented Jan 27, 2023

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:

  1. Install website_sale_checkout_skip_payment and website_delivery.
  2. Configure the customer partner so that the payment screen will be skipped
  3. Configure 2 delivery methods and publish them
  4. Go on eCommerce and buy a product. Select the second delivery method.
  5. Validate
  6. 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
Delivery Methods - Odoo
n the SO on the backend
SO002 - wrong delivery method in backend - Odoo
Administrator_customer_config_skip - Odoo
Payment My Website_Delivery

@vdewulf vdewulf added the bug label Jan 27, 2023
@victor-champonnois
Copy link
Member

victor-champonnois commented Feb 10, 2023

The issue happens at the last step
image
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

at this line

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).

<form target="_self" action="/shop/confirmation" method="post" class="float-right">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<a role="button" class="btn btn-primary a-submit" href="#">
<span>Confirm Order <span class="fa fa-chevron-right"></span></span>
</a>

However I don't have a clearer idea.
@sergio-teruel Do you know a way to fix this issue ?

@sergio-teruel
Copy link
Contributor

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...

@chienandalu
Copy link
Member

@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

@github-actions
Copy link

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.

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

No branches or pull requests

4 participants