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

[17.0][MIG] website_sale_checkout_skip_payment #962

Open
wants to merge 59 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
eaf3f68
[9.0][WIP] website_sale_checkout_skip_payment: New module to skip pay…
sergio-teruel Jul 25, 2017
45ff6f8
[IMP] website_sale_checkout_skip_payment: Texts + code
chienandalu Jul 31, 2017
afc6254
OCA Transbot updated translations from Transifex
oca-transbot Aug 19, 2017
a2179fd
Porting website_sale_checkout_skip_payment to 10.0
eLBati Sep 4, 2017
3710696
[MIG] website_sale_checkout_skip_payment: Migration to 11.0
larmar Dec 24, 2017
e437e3a
[9.0][FIX] website_sale_checkout_skip_paymen: Message error in checko…
sergio-teruel Dec 20, 2017
6b35a00
Removed git
larmar Dec 25, 2017
2ffb4a2
Translated using Weblate (Italian)
paolovalier Dec 28, 2018
18d2d16
Translated using Weblate (Spanish)
mvrodriguez Feb 4, 2019
7a6d370
Translated using Weblate (Spanish)
mvrodriguez Feb 4, 2019
77f8955
[MIG] website_sale_checkout_skip_payment: Migration to v12.0
sergio-teruel Oct 24, 2019
ee40f09
[IMP] website_sale_checkout_skip_payment: black, isort, prettier
Tardo Jan 30, 2020
726de54
[MIG] website_sale_checkout_skip_payment: Migration to 13.0
Tardo Jan 30, 2020
e64aed4
Translated using Weblate (Dutch)
bosd Dec 15, 2020
188958c
Translated using Weblate (Catalan)
claudiagn Feb 25, 2021
6e73ab2
Translated using Weblate (Spanish)
claudiagn Feb 25, 2021
62266fc
[IMP] website_sale_checkout_skip_payment: Changes on Confirm Order Bu…
CarlosRoca13 May 18, 2021
6412118
[FIX] website_sale_checkout_skip_payment: Error when client is public…
CarlosRoca13 May 20, 2021
12c8f3b
[IMP] website_sale_checkout_skip_payment: black, isort, prettier
ferran-S73 Aug 30, 2021
7419916
[14.0][MIG] website_sale_checkout_skip_payment: Migration to V14
ferran-S73 Aug 30, 2021
8b49fec
Translated using Weblate (Spanish (Argentina))
ibuioli Oct 20, 2021
bbdcf36
[MIG] website_sale_checkout_skip_payment: Migration to 15.0
rajpatel2240-odoo Apr 20, 2022
bd89bbb
[FIX] website_sale_checkout_skip_payment: CacheMiss error when sessio…
tarteo Jul 8, 2020
543ebb6
[FIX] website_sale_checkout_skip_payment: Fix tests
CarlosRoca13 May 31, 2022
1495b45
[UPD] Update website_sale_checkout_skip_payment.pot
Sep 5, 2022
7e1db10
[UPD] README.rst
OCA-git-bot Sep 5, 2022
a00c690
Translated using Weblate (Portuguese)
pedrocs-exo Dec 14, 2022
95bc660
Translated using Weblate (Italian)
francesco-ooops Feb 1, 2023
1ca5555
[15.0][IMP] website_sale_checkout_skip_payment: hide payment message
miguel-S73 Feb 15, 2023
84df36a
[UPD] README.rst
OCA-git-bot Feb 15, 2023
29ad9ef
website_sale_checkout_skip_payment 15.0.1.1.0
OCA-git-bot Feb 15, 2023
d4a6321
[FIX] website_sale_checkout_skip_payment: Increase priority to avoid …
sergio-teruel Feb 22, 2023
e961637
website_sale_checkout_skip_payment 15.0.1.2.0
OCA-git-bot Feb 23, 2023
62ce6cd
[TYPO] in README.rst
yvaucher May 3, 2023
b03d439
[UPD] README.rst
OCA-git-bot May 3, 2023
ac260b2
[IMP] : pre-commit stuff
kisuka May 22, 2023
73e8d4e
[MIG] website_sale_checkout_skip_payment: Migration to 16.0
kisuka May 22, 2023
b501d52
Removed old test for website_sale_checkout_skip_payment
kisuka Jul 19, 2023
45e1ade
[UPD] Update website_sale_checkout_skip_payment.pot
Aug 30, 2023
1a6afd7
[UPD] README.rst
OCA-git-bot Aug 30, 2023
c95f643
[UPD] README.rst
OCA-git-bot Sep 3, 2023
44f1be2
Update translation files
weblate Sep 3, 2023
7335f8b
Translated using Weblate (Spanish (Argentina))
ibuioli Sep 4, 2023
2f70369
Translated using Weblate (Spanish)
Ivorra78 Sep 5, 2023
0843d63
[FIX] website_sale_checkout_skip_payment: Fix test by adding the vat
pilarvargas-tecnativa Sep 11, 2023
3c532b9
[BOT] post-merge updates
OCA-git-bot Sep 25, 2023
d237d66
Update translation files
weblate Oct 10, 2023
8509e26
[IMP] website_sale_checkout_skip_payment: test performance improvement
josep-tecnativa Oct 18, 2023
0a5e20a
[BOT] post-merge updates
OCA-git-bot Oct 23, 2023
09e8ad5
Translated using Weblate (French)
remi-filament Nov 30, 2023
beee138
[FIX] website_sale_checkout_skip_payment: Addapt changes set on payme…
CarlosRoca13 Nov 30, 2023
7facf74
[BOT] post-merge updates
OCA-git-bot Dec 5, 2023
6a055a9
Translated using Weblate (Italian)
mymage May 7, 2024
5fa01b3
Translated using Weblate (Portuguese (Brazil))
May 29, 2024
39b7e81
Translated using Weblate (Swedish)
jakobkrabbe Jun 19, 2024
30f8693
[FIX] website_sale_checkout_skip_payment: Fix wrong confirmation method.
pilarvargas-tecnativa Jul 30, 2024
1fecf3a
[BOT] post-merge updates
OCA-git-bot Jul 31, 2024
da8aac8
[IMP] website_sale_checkout_skip_payment: pre-commit auto fixes
alexeirivera87 Aug 5, 2024
768e629
[MIG] website_sale_checkout_skip_payment: Migration to 17.0
alexeirivera87 Aug 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website_sale_checkout_skip_payment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Website Sale Checkout Skip Payment",
"summary": "Skip payment for logged users in checkout process",
"version": "16.0.1.2.0",
"version": "17.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
32 changes: 12 additions & 20 deletions website_sale_checkout_skip_payment/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import http
from odoo import SUPERUSER_ID, http
from odoo.http import request

from odoo.addons.website_sale.controllers.main import WebsiteSale


class CheckoutSkipPaymentWebsite(WebsiteSale):
@http.route()
def shop_payment_get_status(self, sale_order_id, **post):
# When skip payment step, the transaction not exists so only render
# the waiting message in ajax json call
if not request.website.checkout_skip_payment:
return super().shop_payment_get_status(sale_order_id, **post)
return {
"recall": True,
"message": request.website._render(
"website_sale_checkout_skip_payment.order_state_message"
),
}
def _get_shop_payment_values(self, order, **kwargs):
values = super()._get_shop_payment_values(order, **kwargs)
partner = values.get("partner")
if partner.skip_website_checkout_payment:
values["hide_payment_button"] = True
return values

@http.route()
def shop_payment_confirmation(self, **post):
Expand All @@ -28,18 +22,16 @@
confirmation message"""
order_id = request.session.get("sale_last_order_id")
if not request.website.checkout_skip_payment or not order_id:
return super().shop_payment_confirmation(**post)

Check warning on line 25 in website_sale_checkout_skip_payment/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

website_sale_checkout_skip_payment/controllers/main.py#L25

Added line #L25 was not covered by tests
order = request.env["sale.order"].sudo().browse(order_id)
try:
order.with_context(mark_so_as_sent=True)._send_order_confirmation_mail()
order.with_context(send_email=True, mark_so_as_sent=True).with_user(
SUPERUSER_ID
).action_confirm()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done like this for a reason, as pointed some lines below. With overrides like the one sale_financial_risk on action_confirm returning a wizard when the partner risk is exceeded, the cart wouldn't be closed. So better leave it as it was.

except Exception:
return request.render(

Check warning on line 32 in website_sale_checkout_skip_payment/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

website_sale_checkout_skip_payment/controllers/main.py#L31-L32

Added lines #L31 - L32 were not covered by tests
"website_sale_checkout_skip_payment.confirmation_order_error"
)
# This could not finish (e.g.: sale_financial_risk exceeded)
order.action_confirm()
request.website.sale_reset()
return request.render(
"website_sale.confirmation",
{"order": order, "order_tracking_info": self.order_2_return_dict(order)},
)
values = self._prepare_shop_payment_confirmation_values(order)
return request.render("website_sale.confirmation", values)
1 change: 1 addition & 0 deletions website_sale_checkout_skip_payment/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
- Martin Wilderoth \<<martin.wilderoth@linserv.se>\>
- [Studio73](https://www.studio73.es):
- Miguel Gandia \<<miguel@studio73.es>\>
- Alexei Rivera \<<arivera@archeti.com>\>
4 changes: 2 additions & 2 deletions website_sale_checkout_skip_payment/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This module allows to logged users to checkout with no payment step. At
the end of the checkout proccess the quotation is sent to the user email
address and set to *Qoutation Sent* state.
the end of the checkout process the quotation is sent to the user email
address and set to *Quotation Sent* state.
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ <h1 class="title">Website Sale Checkout Skip Payment</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/e-commerce/tree/17.0/website_sale_checkout_skip_payment"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/e-commerce-17-0/e-commerce-17-0-website_sale_checkout_skip_payment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to logged users to checkout with no payment step. At
the end of the checkout proccess the quotation is sent to the user email
address and set to <em>Qoutation Sent</em> state.</p>
the end of the checkout process the quotation is sent to the user email
address and set to <em>Quotation Sent</em> state.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand Down Expand Up @@ -434,6 +434,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Miguel Gandia &lt;<a class="reference external" href="mailto:miguel&#64;studio73.es">miguel&#64;studio73.es</a>&gt;</li>
</ul>
</li>
<li>Alexei Rivera &lt;<a class="reference external" href="mailto:arivera&#64;archeti.com">arivera&#64;archeti.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @odoo-module **/

import {registry} from "@web/core/registry";
import tourUtils from "@website_sale/js/tours/tour_utils";

registry.category("web_tour.tours").add("website_sale_checkout_skip_payment", {
test: true,
url: "/shop",
steps: () => [
...tourUtils.addToCart({productName: "Storage Box"}),
tourUtils.goToCart({quantity: 1}),
tourUtils.goToCheckout(),
{
content: "Click Confirm Button",
trigger: "a[name='confirm_order_checkout_skip_payment']",
},
{
trigger: "h4:contains('Payment Information')",
},
{
content: "Check confirmation and that the cart has been left empty",
trigger: "a:has(.my_cart_quantity:containsExact(0))",
extra_trigger: "h4:contains('Payment Information')",
},
],
});

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath
expr="//div[@id='website_settings']/div[@id='social_default_image_setting']"
position="after"
>
<div class="col-12 o_setting_box" id="sale_checkout_skip_message">
<div class="o_setting_right_pane">
<label
string="Sale Checkout Skip Message"
for="website_sale_checkout_skip_message"
/>
<span
class="fa fa-lg fa-globe"
title="Values set here are website-specific."
groups="website.group_multi_website"
/>
<div class="text-muted">
Message shown to the user when the purchase is finished
<xpath expr="//block[@id='website_shop_checkout']" position="inside">
<setting id="sale_checkout_skip_message">
<label
string="Sale Checkout Skip Message"
for="website_sale_checkout_skip_message"
/>
<span
class="fa fa-lg fa-globe"
title="Values set here are website-specific."
groups="website.group_multi_website"
/>
<div class="text-muted">
Message shown to the user when the purchase is finished
</div>
<div class="content-group">
<div class="row mt16">
<field name="website_sale_checkout_skip_message" />
</div>
<field name="website_sale_checkout_skip_message" />
</div>
</div>
</setting>
</xpath>
</field>
</record>
Expand Down
45 changes: 16 additions & 29 deletions website_sale_checkout_skip_payment/views/website_sale_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Copyright 2017 Sergio Teruel <sergio.teruel@tecnativa.com>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<template id="payment" inherit_id="website_sale.payment" priority="25">
<xpath expr="//div[hasclass('js_payment')]" position="after">
<xpath expr="//t[@name='website_sale_non_free_cart']" position="before">
<div class="d-flex justify-content-between">
<div class="float-left mt-2" t-if="website.checkout_skip_payment">
<a role="button" href="/shop/cart" class="btn btn-secondary">
Expand All @@ -27,7 +27,12 @@
name="csrf_token"
t-att-value="request.csrf_token()"
/>
<a role="button" class="btn btn-primary a-submit" href="#">
<a
role="button"
name="confirm_order_checkout_skip_payment"
class="btn btn-primary a-submit"
href="#"
>
<span>Confirm <span class="fa fa-chevron-right" /></span>
</a>
</form>
Expand All @@ -41,22 +46,23 @@
add="and not website.checkout_skip_payment"
/>
</xpath>
<xpath expr="//div[hasclass('js_payment')]" position="attributes">
</template>
<template id="confirmation" inherit_id="website_sale.confirmation">
<xpath
expr='//div[@t-if="tx_sudo.state in [&apos;pending&apos;, &apos;done&apos;]"]'
position="attributes"
>
<attribute
name="t-if"
separator=" "
add="and not website.checkout_skip_payment"
/>
>tx_sudo.state in ['pending', 'done'] or (website.checkout_skip_payment and order.state == 'sale')</attribute>
</xpath>
</template>
<template id="confirmation" inherit_id="website_sale.confirmation">
<xpath
expr='//t[@t-if="payment_tx_id.state == &apos;done&apos;"]'
expr='//t[@t-if="tx_sudo.state == &apos;done&apos;"]'
position="attributes"
>
<attribute
name="t-if"
>payment_tx_id.state == 'done' or (website.checkout_skip_payment and order.state == 'sale')</attribute>
>tx_sudo.state == 'done' or website.checkout_skip_payment</attribute>
</xpath>
<xpath
expr="//t[@t-call='website_sale.payment_confirmation_status']"
Expand All @@ -82,23 +88,4 @@
<p>Your order is waiting manual confirmation.</p>
<br />
</template>
<template id="cart" inherit_id="website_sale.cart">
<xpath expr="//a[hasclass('btn-primary')]//t[2]/span[1]" position="attributes">
<attribute name="t-if">not website.checkout_skip_payment</attribute>
</xpath>
<xpath expr="//a[hasclass('btn-primary')]//t[2]/span[1]" position="after">
<span t-if="website.checkout_skip_payment">Confirm</span>
</xpath>
</template>
<template id="short_cart_summary" inherit_id="website_sale.short_cart_summary">
<xpath
expr="//a[hasclass('btn-secondary')]//t[2]/span[1]"
position="attributes"
>
<attribute name="t-if">not website.checkout_skip_payment</attribute>
</xpath>
<xpath expr="//a[hasclass('btn-secondary')]//t[2]/span[1]" position="after">
<span t-if="website.checkout_skip_payment">Confirm</span>
</xpath>
</template>
</odoo>
Loading