Skip to content

Commit

Permalink
Merge PR #866 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Dec 31, 2023
2 parents d5f4934 + 117ec8c commit 58fba80
Show file tree
Hide file tree
Showing 23 changed files with 849 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/website_sale_require_login/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
106 changes: 106 additions & 0 deletions website_sale_require_login/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
=========================
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/13.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-13-0/e-commerce-13-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/13.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 <https://github.com/OCA/e-commerce/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 <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_require_login%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa
* LasLabs

Contributors
~~~~~~~~~~~~

* Dave Lasley <dave@laslabs.com>
* Oscar Alcala <oscar@vauxoo.com>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Foram Shah <foram.shah@initos.com>

* `Tecnativa <https://www.tecnativa.com>`_:

* Rafael Blasco
* Jairo Llopis
* Alexandre Diaz

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 <https://github.com/OCA/e-commerce/tree/13.0/website_sale_require_login>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions website_sale_require_login/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 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
from .hooks import post_init_hook
15 changes: 15 additions & 0 deletions website_sale_require_login/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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": "14.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", "views/assets.xml"],
"post_init_hook": "post_init_hook",
}
4 changes: 4 additions & 0 deletions website_sale_require_login/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions website_sale_require_login/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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().checkout(**post)

@http.route(auth="user")
def address(self, **post):
return super().address(**post)
12 changes: 12 additions & 0 deletions website_sale_require_login/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (C) 2020 Alexandre Díaz - Tecnativa S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID, api
from odoo.tools import config


def post_init_hook(cr, registry):
if config["test_enable"] or config["test_file"]:
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
env.ref("website_sale_require_login.cart").active = False
env.ref("website_sale_require_login.short_cart_summary").active = False
14 changes: 14 additions & 0 deletions website_sale_require_login/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
35 changes: 35 additions & 0 deletions website_sale_require_login/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_require_login
#
# Translators:
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: e-commerce (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-06 13:06+0000\n"
"PO-Revision-Date: 2016-05-01 08:33+0000\n"
"Last-Translator: Paolo Valier\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-e-commerce-8-0/"
"language/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#~ msgid ""
#~ "(\n"
#~ " user_id != website.user_id and\n"
#~ " not optional_products and\n"
#~ " website_sale_order and\n"
#~ " website_sale_order.website_order_line\n"
#~ " )"
#~ msgstr ""
#~ "(\n"
#~ "user_id != website.user_id and\n"
#~ "not optional_products and\n"
#~ "website_sale_order and\n"
#~ "website_sale_order.website_order_line\n"
#~ ")"
36 changes: 36 additions & 0 deletions website_sale_require_login/i18n/sl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_require_login
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2016
msgid ""
msgstr ""
"Project-Id-Version: e-commerce (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-29 10:29+0000\n"
"PO-Revision-Date: 2016-04-01 04:55+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-e-commerce-8-0/"
"language/sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"

#~ msgid ""
#~ "(\n"
#~ " user_id != website.user_id and\n"
#~ " not optional_products and\n"
#~ " website_sale_order and\n"
#~ " website_sale_order.website_order_line\n"
#~ " )"
#~ msgstr ""
#~ "(\n"
#~ " user_id != website.user_id and\n"
#~ " not optional_products and\n"
#~ " website_sale_order and\n"
#~ " website_sale_order.website_order_line\n"
#~ " )"
13 changes: 13 additions & 0 deletions website_sale_require_login/i18n/website_sale_require_login.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
4 changes: 4 additions & 0 deletions website_sale_require_login/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
You probably want to enable any user to sign up:

* Go to *Settings > General Settings > Website > Customer Account*.
* Enable *Free sign up*.
10 changes: 10 additions & 0 deletions website_sale_require_login/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* Dave Lasley <dave@laslabs.com>
* Oscar Alcala <oscar@vauxoo.com>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Foram Shah <foram.shah@initos.com>

* `Tecnativa <https://www.tecnativa.com>`_:

* Rafael Blasco
* Jairo Llopis
* Alexandre Diaz
7 changes: 7 additions & 0 deletions website_sale_require_login/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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*.
5 changes: 5 additions & 0 deletions website_sale_require_login/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

* Log out.
* Try to buy something.
* You will be forced to log in.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 58fba80

Please sign in to comment.