Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 1 addition & 5 deletions website_sale_checkout_skip_payment/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================================
Website Sale Checkout Skip Payment
==================================
Expand All @@ -17,7 +13,7 @@ Website Sale Checkout Skip Payment
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github
Expand Down
1 change: 1 addition & 0 deletions website_sale_checkout_skip_payment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"views/website_sale_template.xml",
"views/partner_view.xml",
"views/res_config_settings_views.xml",
"views/sale_order.xml",
],
"assets": {
"web.assets_tests": [
Expand Down
10 changes: 7 additions & 3 deletions website_sale_checkout_skip_payment/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ def shop_payment_confirmation(self, **post):
if not request.website.checkout_skip_payment or not order_id:
return super().shop_payment_confirmation(**post)
order = request.env["sale.order"].sudo().browse(order_id)
confirm = request.website.website_sale_skip_payment_confirm
try:
order.with_context(mark_so_as_sent=True)._send_order_confirmation_mail()
order.website_payment_skipped = True
# This could not finish (e.g.: sale_financial_risk exceeded)
if confirm:
order.with_context(send_email=True).action_confirm()
else:
order.with_context(mark_so_as_sent=True)._send_order_confirmation_mail()
except Exception:
return request.render(
"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()
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/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import res_config_settings
from . import res_partner
from . import sale_order
from . import website
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

website_sale_skip_payment_confirm = fields.Boolean(
related="website_id.website_sale_skip_payment_confirm",
readonly=False,
)
website_sale_checkout_skip_message = fields.Text(
"Website Sale Checkout Skip Message",
related="website_id.website_sale_checkout_skip_message",
Expand Down
14 changes: 14 additions & 0 deletions website_sale_checkout_skip_payment/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 ACSONE SA/NV
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
from odoo import fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

website_payment_skipped = fields.Boolean(
readonly=True,
index=True,
help="This is checked if the sale order has been confirmed with a partner "
"that can skip payment",
)
6 changes: 6 additions & 0 deletions website_sale_checkout_skip_payment/models/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ def _get_default_skip_message(self):
"Our team will check your order and send you payment information soon."
)

website_sale_skip_payment_confirm = fields.Boolean(
string="Confirm the Sale Order when skipping payment",
help="Check this if you want to confirm the sale order when"
"the 'skip payment' option is activated on partner level.",
)

website_sale_checkout_skip_message = fields.Text(
string="Website Sale SKip Message",
required=True,
Expand Down
28 changes: 11 additions & 17 deletions website_sale_checkout_skip_payment/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Website Sale Checkout Skip Payment</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="website-sale-checkout-skip-payment">
<h1 class="title">Website Sale Checkout Skip Payment</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="website-sale-checkout-skip-payment">
<h1>Website Sale Checkout Skip Payment</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9a080bb1584feaba066528920794ca7b67f5e33a1cc7fe4b08f70f5c36527419
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/e-commerce/tree/18.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-18-0/e-commerce-18-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=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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/18.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-18-0/e-commerce-18-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=18.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>
Expand All @@ -393,7 +388,7 @@ <h1>Website Sale Checkout Skip Payment</h1>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Sales &gt; Customers &gt; Sales and Purchases &gt; Sale</em></li>
Expand All @@ -402,30 +397,30 @@ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
</ol>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Website &gt; shop</em> and perform a checkout.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/e-commerce/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_checkout_skip_payment%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
<li>Sergio Teruel</li>
Expand All @@ -443,7 +438,7 @@ <h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -456,6 +451,5 @@ <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
<field name="inherit_id" ref="website_sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//block[@id='website_shop_checkout']" position="inside">
<setting
id="sale_checkout_skip_confirm"
string="Sale Checkout Skip Confirm"
help="Check this if you want to confirm the sale order when the 'skip payment' option is
activated on partner level."
>
<div class="content-group">
<div class="row">
<field name="website_sale_skip_payment_confirm" />
</div>
</div>
</setting>
<setting
id="sale_checkout_skip_message"
string="Sale Checkout Skip Message"
Expand Down
33 changes: 33 additions & 0 deletions website_sale_checkout_skip_payment/views/sale_order.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- Copyright 2025 ACSONE SA/NV
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="payment_term_id" position="after">
<span
class="badge rounded-pill text-bg-warning"
invisible="not website_payment_skipped"
>Payment
skipped</span>
</field>
</field>
</record>

<record id="view_sales_order_filter" model="ir.ui.view">
<field name="name">sale.order.list.select</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter" />
<field name="arch" type="xml">
<filter name="activities_upcoming_all" position="after">
<filter
string="Payment Skipped"
name="website_payment_skipped"
domain="[('website_payment_skipped', '=', True)]"
/>
</filter>
</field>
</record>
</odoo>
20 changes: 2 additions & 18 deletions website_sale_checkout_skip_payment/views/website_sale_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,14 @@
</xpath>
</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"
>tx_sudo.state in ['pending', 'done'] or (website.checkout_skip_payment and order.state == 'sale')</attribute>
</xpath>
<xpath
expr='//t[@t-if="tx_sudo.state == &apos;done&apos;"]'
position="attributes"
>
<attribute
name="t-if"
>tx_sudo.state == 'done' or website.checkout_skip_payment</attribute>
</xpath>
<xpath
expr="//t[@t-call='website_sale.payment_confirmation_status']"
position="after"
>
<div
class="alert alert-info"
role="alert"
t-if="website.checkout_skip_payment"
t-if="order.website_payment_skipped"
>
<span t-field="website.website_sale_checkout_skip_message" />
</div>
Expand All @@ -45,7 +29,7 @@
expr="//t[@t-call='website_sale.payment_confirmation_status']"
position="attributes"
>
<attribute name="t-if">not website.checkout_skip_payment</attribute>
<attribute name="t-if">not order.website_payment_skipped</attribute>
</xpath>
</template>
<template id="navigation_buttons" inherit_id="website_sale.navigation_buttons">
Expand Down
Loading