| @ -0,0 +1,49 @@ | |||
| .. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg | |||
|     :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | |||
|     :alt: License: AGPL-3 | |||
| 
 | |||
| Verify Before Checkout | |||
| ====================== | |||
| This module ensures user verification before product checkout if the user is not logged in. | |||
| 
 | |||
| Configuration | |||
| ============= | |||
| * No additional configuration is needed. | |||
| 
 | |||
| Company | |||
| ------- | |||
| * `Cybrosys Techno Solutions <https://cybrosys.com/>`__ | |||
| 
 | |||
| License | |||
| ------- | |||
| Affero General Public License, v3.0 (AGPL v3) | |||
| (https://www.gnu.org/licenses/agpl-3.0-standalone.html) | |||
| 
 | |||
| Credits | |||
| ------- | |||
| * Developers: (V16) Renu M, | |||
|               (V17) Gayathri V, | |||
|               (V18) Aysha Shalin | |||
|   Contact: odoo@cybrosys.com | |||
| 
 | |||
| Contacts | |||
| -------- | |||
| * Mail Contact : odoo@cybrosys.com | |||
| * Website : https://cybrosys.com | |||
| 
 | |||
| Bug Tracker | |||
| ----------- | |||
| Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. | |||
| 
 | |||
| Maintainer | |||
| ========== | |||
| .. image:: https://cybrosys.com/images/logo.png | |||
|    :target: https://cybrosys.com | |||
| 
 | |||
| This module is maintained by Cybrosys Technologies. | |||
| 
 | |||
| For support and more information, please visit `Our Website <https://cybrosys.com/>`__ | |||
| 
 | |||
| Further information | |||
| =================== | |||
| HTML Description: `<static/description/index.html>`__ | |||
| @ -0,0 +1,22 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################### | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author: Aysha Shalin (odoo@cybrosys.com) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC | |||
| #    LICENSE (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################### | |||
| from . import controllers | |||
| @ -0,0 +1,42 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################### | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author: Aysha Shalin (odoo@cybrosys.com) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC | |||
| #    LICENSE (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################### | |||
| { | |||
|     'name': 'Verify Before Checkout', | |||
|     'version': '18.0.1.0.0', | |||
|     'category': 'Extra Tools', | |||
|     'summary': """"Verify the user before proceeding to product checkout.""", | |||
|     'description': """"This module ensures user verification before product | |||
|     checkout if the user is not logged in.""", | |||
|     'author': 'Cybrosys Techno Solutions', | |||
|     'company': 'Cybrosys Techno Solutions', | |||
|     'maintainer': 'Cybrosys Techno Solutions', | |||
|     'website': 'https://www.cybrosys.com', | |||
|     'depends': ['website_sale', 'portal'], | |||
|     'data': [ | |||
|         'views/portal_templates.xml' | |||
|     ], | |||
|     'images': ['static/description/banner.png'], | |||
|     'license': 'AGPL-3', | |||
|     'installable': True, | |||
|     'auto_install': False, | |||
|     'application': False, | |||
| } | |||
| @ -0,0 +1,22 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################### | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author: Aysha Shalin (odoo@cybrosys.com) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC | |||
| #    LICENSE (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################### | |||
| from . import login_to_checkout | |||
| @ -0,0 +1,53 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################### | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author: Aysha Shalin (odoo@cybrosys.com) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC | |||
| #    LICENSE (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################### | |||
| from odoo.http import request | |||
| from odoo import http | |||
| from odoo.addons.payment.controllers import portal as payment_portal | |||
| 
 | |||
| 
 | |||
| class WebsiteSaleForm(payment_portal.PaymentPortal): | |||
| 
 | |||
|     @http.route('/shop/payment', type='http', auth='public', website=True, | |||
|                 sitemap=False) | |||
|     def shop_payment(self, **post): | |||
|         """ Payment step. This page proposes several payment means based on available | |||
|         payment.provider. State at this point : | |||
| 
 | |||
|         - a draft sales order with lines; otherwise, clean context/session and | |||
|           back to the shop. | |||
|         - no transaction in context/session, or only a draft one, if the customer | |||
|           did go to a payment.provider website but closed the tab without | |||
|           paying/canceling. | |||
|         """ | |||
|         if request.env.user._is_public(): | |||
|             return request.redirect('/web/login') | |||
|         else: | |||
|             order_sudo = request.website.sale_get_order() | |||
|             if redirection := self._check_cart_and_addresses(order_sudo): | |||
|                 return redirection | |||
|             render_values = self._get_shop_payment_values(order_sudo, **post) | |||
|             render_values[ | |||
|                 'only_services'] = order_sudo and order_sudo.only_services | |||
|             if render_values['errors']: | |||
|                 render_values.pop('payment_methods_sudo', '') | |||
|                 render_values.pop('tokens_sudo', '') | |||
|             return request.render("website_sale.payment", render_values) | |||
| @ -0,0 +1,6 @@ | |||
| ## Module <login_to_checkout> | |||
| 
 | |||
| #### 09.10.2024 | |||
| #### Version 18.0.1.0.0 | |||
| ##### ADD | |||
| - Initial commit for Verify Before Checkout | |||
| After Width: | Height: | Size: 2.2 KiB | 
| After Width: | Height: | Size: 28 KiB | 
| After Width: | Height: | Size: 628 KiB | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 210 KiB | 
| After Width: | Height: | Size: 209 KiB | 
| After Width: | Height: | Size: 109 KiB | 
| After Width: | Height: | Size: 495 B | 
| After Width: | Height: | Size: 1.0 KiB | 
| After Width: | Height: | Size: 624 B | 
| After Width: | Height: | Size: 136 KiB | 
| After Width: | Height: | Size: 214 KiB | 
| After Width: | Height: | Size: 36 KiB | 
| After Width: | Height: | Size: 3.6 KiB | 
| After Width: | Height: | Size: 310 B | 
| After Width: | Height: | Size: 929 B | 
| After Width: | Height: | Size: 1.3 KiB | 
| After Width: | Height: | Size: 3.3 KiB | 
| After Width: | Height: | Size: 1.4 KiB | 
| After Width: | Height: | Size: 17 KiB | 
| After Width: | Height: | Size: 542 B | 
| After Width: | Height: | Size: 576 B | 
| After Width: | Height: | Size: 733 B | 
| After Width: | Height: | Size: 4.3 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 4.0 KiB | 
| After Width: | Height: | Size: 1.7 KiB | 
| After Width: | Height: | Size: 2.2 KiB | 
| After Width: | Height: | Size: 911 B | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 600 B | 
| After Width: | Height: | Size: 673 B | 
| After Width: | Height: | Size: 2.0 KiB | 
| After Width: | Height: | Size: 462 B | 
| After Width: | Height: | Size: 2.1 KiB | 
| After Width: | Height: | Size: 926 B | 
| After Width: | Height: | Size: 9.0 KiB | 
| After Width: | Height: | Size: 23 KiB | 
| After Width: | Height: | Size: 7.0 KiB | 
| After Width: | Height: | Size: 878 B | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 653 B | 
| After Width: | Height: | Size: 800 B | 
| After Width: | Height: | Size: 905 B | 
| After Width: | Height: | Size: 189 KiB | 
| After Width: | Height: | Size: 4.3 KiB | 
| After Width: | Height: | Size: 839 B | 
| After Width: | Height: | Size: 1.7 KiB | 
| After Width: | Height: | Size: 5.9 KiB | 
| After Width: | Height: | Size: 1.6 KiB | 
| After Width: | Height: | Size: 34 KiB | 
| After Width: | Height: | Size: 26 KiB | 
| After Width: | Height: | Size: 3.8 KiB | 
| After Width: | Height: | Size: 23 KiB | 
| After Width: | Height: | Size: 1.9 KiB | 
| After Width: | Height: | Size: 2.3 KiB | 
| After Width: | Height: | Size: 427 B | 
| After Width: | Height: | Size: 627 B | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 988 B | 
| After Width: | Height: | Size: 3.7 KiB | 
| After Width: | Height: | Size: 5.0 KiB | 
| After Width: | Height: | Size: 875 B | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 757 KiB | 
| After Width: | Height: | Size: 95 KiB | 
| After Width: | Height: | Size: 85 KiB | 
| After Width: | Height: | Size: 126 KiB | 
| After Width: | Height: | Size: 146 KiB | 
| After Width: | Height: | Size: 127 KiB | 
| After Width: | Height: | Size: 73 KiB | 
| After Width: | Height: | Size: 58 KiB | 
| After Width: | Height: | Size: 34 KiB | 
| After Width: | Height: | Size: 59 KiB | 
| After Width: | Height: | Size: 880 KiB | 
| After Width: | Height: | Size: 88 KiB | 
| After Width: | Height: | Size: 9.5 KiB | 
| @ -0,0 +1,190 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
|     <template id="verify_checkout" inherit_id="website_sale.navigation_buttons"> | |||
|         <!-- Replacing the button checkout --> | |||
|         <xpath expr="//div" position="replace"> | |||
|             <!-- Checking if it is a public user.if it is a public user then open a modal to verify --> | |||
|             <t t-if="website.is_public_user()"> | |||
|                 <t t-set="step_specific_values" | |||
|                    t-value="website._get_checkout_steps(xmlid)"/> | |||
|                 <div t-attf-class="#{_container_classes} d-flex #{_form_send_navigation and 'flex-column flex-lg-row align-items-lg-center' or 'flex-column'} pt-4"> | |||
|                     <t t-if="website_sale_order and website_sale_order.website_order_line"> | |||
|                         <t t-if="xmlid == 'website_sale.payment'"> | |||
|                             <div t-if="not website_sale_order.amount_total" | |||
|                                  name="o_website_sale_free_cart"> | |||
|                                 <form name="o_wsale_confirm_order" | |||
|                                       class="d-flex flex-column" | |||
|                                       target="_self" | |||
|                                       action="/shop/payment/validate" | |||
|                                       method="post"> | |||
|                                     <input type="hidden" | |||
|                                            name="csrf_token" | |||
|                                            t-att-value="request.csrf_token()" | |||
|                                            t-nocache="The csrf token must always be up to date."/> | |||
|                                     <t t-call="payment.submit_button"> | |||
|                                         <t t-set="submit_button_label">Confirm | |||
|                                             Order | |||
|                                         </t> | |||
|                                     </t> | |||
|                                 </form> | |||
|                             </div> | |||
|                             <t t-else="" t-call="payment.submit_button"/> | |||
|                         </t> | |||
|                         <t t-else=""> | |||
|                             <a role="button" class="btn btn-primary float-end" | |||
|                                name="website_sale_main_button" | |||
|                                data-bs-toggle="modal" | |||
|                                t-attf-class="#{_cta_classes} btn btn-primary #{not website_sale_order._is_cart_ready() and 'disabled'} #{_form_send_navigation and 'order-lg-3 w-100 w-lg-auto ms-lg-auto' or 'w-100'}" | |||
|                                data-bs-target="#portal_deactivate_account_modal"> | |||
|                                 <span>Process Checkout</span> | |||
|                                 <span class="fa fa-chevron-right"/> | |||
|                             </a> | |||
|                             <div t-attf-class="modal #{'show d-block' if open_deactivate_modal else ''}" | |||
|                                  id="portal_deactivate_account_modal" | |||
|                                  tabindex="-1" | |||
|                                  role="dialog"> | |||
|                                 <div class="modal-dialog" role="document"> | |||
|                                     <div class="modal-content" style="margin-top:50px;"> | |||
|                                         <div class="modal-header"> | |||
|                                             <button type="button" | |||
|                                                     class="btn-close" | |||
|                                                     data-bs-dismiss="modal"/> | |||
|                                         </div> | |||
|                                         <form class="oe_login_form modal-body" | |||
|                                               role="form" | |||
|                                               t-attf-action="/web/login" | |||
|                                               method="post" | |||
|                                               onsubmit="this.action = '/web/login' + location.hash"> | |||
|                                             <input type="hidden" | |||
|                                                    name="csrf_token" | |||
|                                                    t-att-value="request.csrf_token()"/> | |||
|                                             <div class="mb-3 field-login"> | |||
|                                                 <label for="login" | |||
|                                                        class="form-label"> | |||
|                                                     Email | |||
|                                                 </label> | |||
|                                                 <input type="text" | |||
|                                                        placeholder="Email" | |||
|                                                        name="login" | |||
|                                                        t-att-value="login" | |||
|                                                        id="login" | |||
|                                                        t-attf-class="form-control #{'form-control-sm' if form_small else ''}" | |||
|                                                        required="required" | |||
|                                                        autofocus="autofocus" | |||
|                                                        autocapitalize="off"/> | |||
|                                             </div> | |||
|                                             <div class="mb-3"> | |||
|                                                 <label for="password" | |||
|                                                        class="form-label"> | |||
|                                                     Password | |||
|                                                 </label> | |||
|                                                 <input type="password" | |||
|                                                        placeholder="Password" | |||
|                                                        name="password" | |||
|                                                        id="password" | |||
|                                                        t-attf-class="form-control #{'form-control-sm' if form_small else ''}" | |||
|                                                        required="required" | |||
|                                                        autocomplete="current-password" | |||
|                                                        t-att-autofocus="'autofocus' if login else None" | |||
|                                                        maxlength="4096"/> | |||
|                                             </div> | |||
|                                             <p class="alert alert-danger" | |||
|                                                t-if="error" | |||
|                                                role="alert"> | |||
|                                                 <t t-esc="error"/> | |||
|                                             </p> | |||
|                                             <p class="alert alert-success" | |||
|                                                t-if="message" role="status"> | |||
|                                                 <t t-esc="message"/> | |||
|                                             </p> | |||
|                                             <div t-attf-class="clearfix oe_login_buttons text-center gap-1 d-grid mb-1 {{'pt-2' if form_small else 'pt-3'}}"> | |||
|                                                 <button type="submit" | |||
|                                                         class="btn btn-primary"> | |||
|                                                     Log | |||
|                                                     in | |||
|                                                 </button> | |||
|                                                 <div class="o_login_auth"/> | |||
|                                             </div> | |||
|                                             <div class="justify-content-between mt-2 d-flex small"> | |||
|                                                 <a href="/web/signup?">Don't | |||
|                                                     have an | |||
|                                                     account? | |||
|                                                 </a> | |||
|                                                 <a href="/web/reset_password?"> | |||
|                                                     Reset | |||
|                                                     Password | |||
|                                                 </a> | |||
|                                             </div> | |||
|                                             <t t-set="redirect_url" | |||
|                                                t-value="'/web/login?redirect=/shop/checkout' if redirect_to_sign_in else '/shop/checkout?express=1'"/> | |||
|                                             <input type="hidden" name="redirect" | |||
|                                                    t-att-value="redirect_url"/> | |||
|                                         </form> | |||
|                                     </div> | |||
|                                 </div> | |||
|                             </div> | |||
|                         </t> | |||
|                     </t> | |||
|                     <div t-attf-class="position-relative #{_form_send_navigation and 'd-flex d-lg-none' or 'd-flex'} w-100 justify-content-center align-items-center my-2 opacity-75"> | |||
|                         <hr class="w-100"/> | |||
|                         <span class="px-3">or</span> | |||
|                         <hr class="w-100"/> | |||
|                     </div> | |||
|                     <a t-att-href="step_specific_values['back_button_href']" | |||
|                        class="text-center"> | |||
|                         <i class="fa fa-angle-left me-2 fw-light"/> | |||
|                         <t t-out="step_specific_values['back_button']"/> | |||
|                     </a> | |||
|                 </div> | |||
|             </t> | |||
|             <!-- If not then move to checkout page --> | |||
|             <t t-else=""> | |||
|                 <t t-set="step_specific_values" | |||
|                    t-value="website._get_checkout_steps(xmlid)"/> | |||
|                 <div t-attf-class="#{_container_classes} d-flex #{_form_send_navigation and 'flex-column flex-lg-row align-items-lg-center' or 'flex-column'} pt-4"> | |||
|                     <t t-if="website_sale_order and website_sale_order.website_order_line"> | |||
|                         <t t-if="xmlid == 'website_sale.payment'"> | |||
|                             <div t-if="not website_sale_order.amount_total" | |||
|                                  name="o_website_sale_free_cart"> | |||
|                                 <form name="o_wsale_confirm_order" | |||
|                                       class="d-flex flex-column" | |||
|                                       target="_self" | |||
|                                       action="/shop/payment/validate" | |||
|                                       method="post"> | |||
|                                     <input type="hidden" | |||
|                                            name="csrf_token" | |||
|                                            t-att-value="request.csrf_token()" | |||
|                                            t-nocache="The csrf token must always be up to date."/> | |||
|                                     <t t-call="payment.submit_button"> | |||
|                                         <t t-set="submit_button_label">Confirm | |||
|                                             Order | |||
|                                         </t> | |||
|                                     </t> | |||
|                                 </form> | |||
|                             </div> | |||
|                             <t t-else="" t-call="payment.submit_button"/> | |||
|                         </t> | |||
|                         <t t-else=""> | |||
|                             <a role="button" name="website_sale_main_button" | |||
|                                t-attf-class="#{_cta_classes} btn btn-primary #{not website_sale_order._is_cart_ready() and 'disabled'} #{_form_send_navigation and 'order-lg-3 w-100 w-lg-auto ms-lg-auto' or 'w-100'}" | |||
|                                t-att-href="step_specific_values['main_button_href']"> | |||
|                                 <t t-out="step_specific_values['main_button']"/> | |||
|                                 <i class="fa fa-angle-right ms-2 fw-light"/> | |||
|                             </a> | |||
|                         </t> | |||
|                     </t> | |||
|                     <div t-attf-class="position-relative #{_form_send_navigation and 'd-flex d-lg-none' or 'd-flex'} w-100 justify-content-center align-items-center my-2 opacity-75"> | |||
|                         <hr class="w-100"/> | |||
|                         <span class="px-3">or</span> | |||
|                         <hr class="w-100"/> | |||
|                     </div> | |||
|                     <a t-att-href="step_specific_values['back_button_href']" | |||
|                        class="text-center"> | |||
|                         <i class="fa fa-angle-left me-2 fw-light"/> | |||
|                         <t t-out="step_specific_values['back_button']"/> | |||
|                     </a> | |||
|                 </div> | |||
|             </t> | |||
|         </xpath> | |||
|     </template> | |||
| </odoo> | |||