diff --git a/website_sale_checkout_skip_payment/README.rst b/website_sale_checkout_skip_payment/README.rst index a800e96d06..3229b7e8cd 100644 --- a/website_sale_checkout_skip_payment/README.rst +++ b/website_sale_checkout_skip_payment/README.rst @@ -80,6 +80,7 @@ Contributors - David Vidal - Alexandre Díaz - Carlos Roca + - Pilar Vargas - Martin Wilderoth - `Studio73 `__: diff --git a/website_sale_checkout_skip_payment/__manifest__.py b/website_sale_checkout_skip_payment/__manifest__.py index f62378fb0d..ebe9e49234 100644 --- a/website_sale_checkout_skip_payment/__manifest__.py +++ b/website_sale_checkout_skip_payment/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Website Sale Checkout Skip Payment", "summary": "Skip payment for logged users in checkout process", - "version": "16.0.1.2.1", + "version": "18.0.1.0.0", "category": "Website", "website": "https://github.com/OCA/e-commerce", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/website_sale_checkout_skip_payment/controllers/main.py b/website_sale_checkout_skip_payment/controllers/main.py index 5688e9d92e..f4d6181324 100644 --- a/website_sale_checkout_skip_payment/controllers/main.py +++ b/website_sale_checkout_skip_payment/controllers/main.py @@ -9,18 +9,12 @@ 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): @@ -39,7 +33,5 @@ def shop_payment_confirmation(self, **post): # 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) diff --git a/website_sale_checkout_skip_payment/i18n/es.po b/website_sale_checkout_skip_payment/i18n/es.po index 362d06938b..2a25e94c3b 100644 --- a/website_sale_checkout_skip_payment/i18n/es.po +++ b/website_sale_checkout_skip_payment/i18n/es.po @@ -121,13 +121,3 @@ msgstr "Mensaje de omisión de venta del sitio web" #: model_terms:ir.ui.view,arch_db:website_sale_checkout_skip_payment.order_state_message msgid "Your order is waiting manual confirmation." msgstr "Su pedido está a la espera de confirmación manual." - -#~ msgid "" -#~ "\n" -#~ " Return to Cart" -#~ msgstr "" -#~ "\n" -#~ " Devolver al carrito" - -#~ msgid "Confirm " -#~ msgstr "Confirmar " diff --git a/website_sale_checkout_skip_payment/models/__init__.py b/website_sale_checkout_skip_payment/models/__init__.py index 69a4c48d19..61e4795980 100644 --- a/website_sale_checkout_skip_payment/models/__init__.py +++ b/website_sale_checkout_skip_payment/models/__init__.py @@ -1,3 +1,3 @@ -from . import website -from . import res_partner from . import res_config_settings +from . import res_partner +from . import website diff --git a/website_sale_checkout_skip_payment/models/website.py b/website_sale_checkout_skip_payment/models/website.py index 8499fc355e..7cfcae4c75 100644 --- a/website_sale_checkout_skip_payment/models/website.py +++ b/website_sale_checkout_skip_payment/models/website.py @@ -8,13 +8,16 @@ class Website(models.Model): _inherit = "website" + def _get_default_skip_message(self): + return _( + "Our team will check your order and send you payment information soon." + ) + website_sale_checkout_skip_message = fields.Text( string="Website Sale SKip Message", required=True, translate=True, - default=lambda s: _( - "Our team will check your order and send you payment information soon." - ), + default=_get_default_skip_message, ) checkout_skip_payment = fields.Boolean(compute="_compute_checkout_skip_payment") diff --git a/website_sale_checkout_skip_payment/readme/CONTRIBUTORS.md b/website_sale_checkout_skip_payment/readme/CONTRIBUTORS.md index 1d9ef29609..725af11209 100644 --- a/website_sale_checkout_skip_payment/readme/CONTRIBUTORS.md +++ b/website_sale_checkout_skip_payment/readme/CONTRIBUTORS.md @@ -3,6 +3,7 @@ - David Vidal - Alexandre Díaz - Carlos Roca + - Pilar Vargas - Martin Wilderoth \<\> - [Studio73](https://www.studio73.es): - Miguel Gandia \<\> diff --git a/website_sale_checkout_skip_payment/static/description/index.html b/website_sale_checkout_skip_payment/static/description/index.html index ddde0e19a2..2f43ba1489 100644 --- a/website_sale_checkout_skip_payment/static/description/index.html +++ b/website_sale_checkout_skip_payment/static/description/index.html @@ -427,6 +427,7 @@

Contributors

  • David Vidal
  • Alexandre Díaz
  • Carlos Roca
  • +
  • Pilar Vargas
  • Martin Wilderoth <martin.wilderoth@linserv.se>
  • diff --git a/website_sale_checkout_skip_payment/static/tests/tours/website_sale_checkout_skip_payment_tour.esm.js b/website_sale_checkout_skip_payment/static/tests/tours/website_sale_checkout_skip_payment_tour.esm.js new file mode 100644 index 0000000000..97ee37201c --- /dev/null +++ b/website_sale_checkout_skip_payment/static/tests/tours/website_sale_checkout_skip_payment_tour.esm.js @@ -0,0 +1,33 @@ +/** @odoo-module **/ + +import {registry} from "@web/core/registry"; +import * as tourUtils from "@website_sale/js/tours/tour_utils"; + +registry.category("web_tour.tours").add("website_sale_checkout_skip_payment", { + url: "/shop", + steps: () => [ + ...tourUtils.searchProduct("Storage Box"), + { + content: "select Storage Box", + trigger: '.oe_product_cart:first a:contains("Storage Box")', + run: "click", + }, + { + content: "click on add to cart", + trigger: '#product_detail form[action^="/shop/cart/update"] #add_to_cart', + run: "click", + }, + tourUtils.goToCart({quantity: 1}), + tourUtils.goToCheckout(), + tourUtils.confirmOrder(), + { + content: "Confirm order", + trigger: "a.a-submit[href='#']:contains('Confirm')", + run: "click", + }, + { + content: "Print order", + trigger: "a[href='/shop/print']", + }, + ], +}); diff --git a/website_sale_checkout_skip_payment/static/tests/tours/website_sale_checkout_skip_payment_tour.js b/website_sale_checkout_skip_payment/static/tests/tours/website_sale_checkout_skip_payment_tour.js deleted file mode 100644 index ea59773991..0000000000 --- a/website_sale_checkout_skip_payment/static/tests/tours/website_sale_checkout_skip_payment_tour.js +++ /dev/null @@ -1,47 +0,0 @@ -odoo.define("website_sale_checkout_skip_payment.tour", function (require) { - "use strict"; - - var tour = require("web_tour.tour"); - const tourUtils = require("website_sale.tour_utils"); - - tour.register( - "website_sale_checkout_skip_payment", - { - test: true, - url: "/shop?search=Storage%20Box", - }, - [ - { - content: "select Storage Box", - extra_trigger: ".oe_search_found", - trigger: '.oe_product_cart a:contains("Storage Box")', - }, - { - content: "Add Storage Box into cart", - trigger: "a:contains(ADD TO CART)", - }, - tourUtils.goToCart(), - { - content: "go to checkout", - extra_trigger: "#cart_products input.js_quantity:propValue(1)", - trigger: 'a[href*="/shop/checkout"]', - }, - { - trigger: '.btn-primary:contains("Confirm")', - }, - { - trigger: ".btn:contains('Confirm')", - extra_trigger: "b:contains('Billing & Shipping:')", - }, - { - trigger: "a[href='/shop']", - extra_trigger: "strong:contains('Payment Information:')", - }, - { - content: "Check confirmation and that the cart has been left empty", - trigger: "a:has(.my_cart_quantity:containsExact(0))", - extra_trigger: "strong:contains('Payment Information:')", - }, - ] - ); -}); diff --git a/website_sale_checkout_skip_payment/tests/test_checkout_skip_payment.py b/website_sale_checkout_skip_payment/tests/test_checkout_skip_payment.py index 5d938f43c1..61f1339601 100644 --- a/website_sale_checkout_skip_payment/tests/test_checkout_skip_payment.py +++ b/website_sale_checkout_skip_payment/tests/test_checkout_skip_payment.py @@ -32,4 +32,4 @@ def test_checkout_skip_payment(self): def test_ui_website(self): """Test frontend tour.""" - self.start_tour("/shop", "website_sale_checkout_skip_payment", login="admin") + self.start_tour("/", "website_sale_checkout_skip_payment", login="admin") diff --git a/website_sale_checkout_skip_payment/views/res_config_settings_views.xml b/website_sale_checkout_skip_payment/views/res_config_settings_views.xml index 9691c96f9d..386e837afc 100644 --- a/website_sale_checkout_skip_payment/views/res_config_settings_views.xml +++ b/website_sale_checkout_skip_payment/views/res_config_settings_views.xml @@ -2,29 +2,20 @@ res.config.settings - + - -
    -
    -