From d6de99c5aa8ba4b1e15ac47aa307cdef0d1cb5e2 Mon Sep 17 00:00:00 2001 From: santiky Date: Fri, 22 Apr 2022 19:48:25 +0200 Subject: [PATCH] requiere login para realizar el checkout, cogido de OCA/e-commnerce --- website_sale_require_login/README.rst | 101 ++++ website_sale_require_login/__init__.py | 4 + website_sale_require_login/__manifest__.py | 24 + .../controllers/__init__.py | 4 + .../controllers/main.py | 11 + .../demo/demo_assets.xml | 14 + website_sale_require_login/i18n/ca.po | 14 + website_sale_require_login/i18n/de.po | 14 + website_sale_require_login/i18n/es.po | 14 + website_sale_require_login/i18n/es_CL.po | 14 + website_sale_require_login/i18n/fr.po | 14 + website_sale_require_login/i18n/it.po | 35 ++ website_sale_require_login/i18n/sl.po | 36 ++ .../readme/CONFIGURE.rst | 4 + .../readme/CONTRIBUTORS.rst | 5 + .../readme/DESCRIPTION.rst | 7 + website_sale_require_login/readme/USAGE.rst | 5 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 448 ++++++++++++++++++ .../js/website_sale_tour_buy_login.tour.js | 60 +++ website_sale_require_login/tests/__init__.py | 1 + .../tests/test_checkout.py | 31 ++ .../views/website_sale.xml | 25 + 23 files changed, 885 insertions(+) create mode 100644 website_sale_require_login/README.rst create mode 100644 website_sale_require_login/__init__.py create mode 100644 website_sale_require_login/__manifest__.py create mode 100644 website_sale_require_login/controllers/__init__.py create mode 100644 website_sale_require_login/controllers/main.py create mode 100644 website_sale_require_login/demo/demo_assets.xml create mode 100644 website_sale_require_login/i18n/ca.po create mode 100644 website_sale_require_login/i18n/de.po create mode 100644 website_sale_require_login/i18n/es.po create mode 100644 website_sale_require_login/i18n/es_CL.po create mode 100644 website_sale_require_login/i18n/fr.po create mode 100644 website_sale_require_login/i18n/it.po create mode 100644 website_sale_require_login/i18n/sl.po create mode 100644 website_sale_require_login/readme/CONFIGURE.rst create mode 100644 website_sale_require_login/readme/CONTRIBUTORS.rst create mode 100644 website_sale_require_login/readme/DESCRIPTION.rst create mode 100644 website_sale_require_login/readme/USAGE.rst create mode 100644 website_sale_require_login/static/description/icon.png create mode 100644 website_sale_require_login/static/description/index.html create mode 100644 website_sale_require_login/static/src/js/website_sale_tour_buy_login.tour.js create mode 100644 website_sale_require_login/tests/__init__.py create mode 100644 website_sale_require_login/tests/test_checkout.py create mode 100644 website_sale_require_login/views/website_sale.xml diff --git a/website_sale_require_login/README.rst b/website_sale_require_login/README.rst new file mode 100644 index 0000000..b0a6e63 --- /dev/null +++ b/website_sale_require_login/README.rst @@ -0,0 +1,101 @@ +========================= +Require login to checkout +========================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/12.0/website_sale_require_login + :alt: OCA/e-commerce +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-commerce-12-0/e-commerce-12-0-website_sale_require_login + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/113/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of eCommerce to force users +to login before buying anything in the website and allow you to get rid of +those duplicated entries of returning unauthenticated users. + +If you do not allow external users to sign up, this can serve you to make +checkout available only for those that have a user account, and make some sort +of *members club*. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +You probably want to enable any user to sign up: + +* Go to *Settings > General Settings > Website > Customer Account*. +* Enable *Free sign up*. + +Usage +===== + +To use this module, you need to: + +* Log out. +* Try to buy something. +* You will be forced to log in. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa +* LasLabs + +Contributors +~~~~~~~~~~~~ + +* Rafael Blasco +* Jairo Llopis +* Dave Lasley +* Oscar Alcala +* Lorenzo Battistini + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/e-commerce `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_require_login/__init__.py b/website_sale_require_login/__init__.py new file mode 100644 index 0000000..2e4ebb3 --- /dev/null +++ b/website_sale_require_login/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2015 Antiun Ingeniería, S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import controllers diff --git a/website_sale_require_login/__manifest__.py b/website_sale_require_login/__manifest__.py new file mode 100644 index 0000000..682a644 --- /dev/null +++ b/website_sale_require_login/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2015 Antiun Ingeniería, S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Require login to checkout", + "summary": "Force users to login for buying", + "version": "12.0.1.0.0", + "category": "Website", + "website": "https://github.com/OCA/e-commerce", + "author": "Tecnativa, " + "LasLabs, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": [ + "website_sale_suggest_create_account", + "web_tour", + ], + "data": [ + "views/website_sale.xml", + ], + 'demo': [ + "demo/demo_assets.xml", + ], +} diff --git a/website_sale_require_login/controllers/__init__.py b/website_sale_require_login/controllers/__init__.py new file mode 100644 index 0000000..dd3803d --- /dev/null +++ b/website_sale_require_login/controllers/__init__.py @@ -0,0 +1,4 @@ +# © 2015 Antiun Ingeniería, S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import main diff --git a/website_sale_require_login/controllers/main.py b/website_sale_require_login/controllers/main.py new file mode 100644 index 0000000..f02a352 --- /dev/null +++ b/website_sale_require_login/controllers/main.py @@ -0,0 +1,11 @@ +# Copyright 2015 Antiun Ingeniería, S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import http +from odoo.addons.website_sale.controllers.main import WebsiteSale + + +class RequireLoginToCheckout(WebsiteSale): + @http.route(auth="user") + def checkout(self, **post): + return super(RequireLoginToCheckout, self).checkout(**post) diff --git a/website_sale_require_login/demo/demo_assets.xml b/website_sale_require_login/demo/demo_assets.xml new file mode 100644 index 0000000..dc8ba7e --- /dev/null +++ b/website_sale_require_login/demo/demo_assets.xml @@ -0,0 +1,14 @@ + + + + + +