-
-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from Tecnativa/9.0-mig-website_sale_require_l…
…egal [9.0] [MIG] website_sale_require_legal module
- Loading branch information
Showing
12 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
========================================= | ||
Require accepting legal terms to checkout | ||
========================================= | ||
|
||
This module was written to extend the functionality of your website shop to | ||
support forcing the user to accept your legal advice, terms of use and privacy | ||
policy, and allow you to comply with some countries' laws. | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
* Install repository `OCA/website <https://github.com/OCA/website>`_. | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
* Set up your legal pages. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
* Buy something from your website. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/113/9.0 | ||
|
||
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. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Rafael Blasco <rafaelbn@antiun.com> | ||
* Jairo Llopis <yajo.sk8@gmail.com> | ||
* Vicent Cubells <vicent.cubells@tecnativa.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015 Tecnativa - Jairo Llopis | ||
# Copyright 2016 Tecnativa - Vicent Cubells | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015 Tecnativa - Jairo Llopis | ||
# Copyright 2016 Tecnativa - Vicent Cubells | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Require accepting legal terms to checkout", | ||
"summary": "Force the user to accept legal tems to buy in the web shop", | ||
"version": "9.0.1.0.0", | ||
"category": "Website", | ||
"website": "http://www.tecnativa.com", | ||
"author": "Antiun Ingeniería S.L., " | ||
"Tecnativa, " | ||
"Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"website_legal_page", | ||
"website_sale", | ||
], | ||
"data": [ | ||
"views/website_sale.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015 Tecnativa - Jairo Llopis | ||
# Copyright 2016 Tecnativa - Vicent Cubells | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015 Tecnativa - Jairo Llopis | ||
# Copyright 2016 Tecnativa - Vicent Cubells | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openerp.http import request | ||
from openerp.sql_db import TestCursor | ||
from openerp.addons.website_sale.controllers.main import website_sale | ||
|
||
|
||
class RequireLegalTermsToCheckout(website_sale): | ||
def checkout_parse(self, address_type, data, remove_prefix=False, | ||
*args, **kwargs): | ||
"""Require accepting legal terms to buy.""" | ||
result = (super(RequireLegalTermsToCheckout, self). | ||
checkout_parse(address_type, data, remove_prefix, | ||
*args, **kwargs)) | ||
|
||
# Avoid PhantomJS errors in test mode | ||
if (not isinstance(request.env.cr, TestCursor) and | ||
address_type == "billing"): | ||
result["accepted_legal_terms"] = ( | ||
bool(request.params.get("accepted_legal_terms"))) | ||
|
||
return result | ||
|
||
def checkout_form_save(self, checkout, *args, **kwargs): | ||
"""Do not use accepting legal terms to save.""" | ||
if "accepted_legal_terms" in checkout: | ||
del checkout["accepted_legal_terms"] | ||
|
||
return super(RequireLegalTermsToCheckout, self).checkout_form_save( | ||
checkout, *args, **kwargs) | ||
|
||
def checkout_form_validate(self, data, *args, **kwargs): | ||
"""Require accepting legal terms to buy.""" | ||
errors = (super(RequireLegalTermsToCheckout, self) | ||
.checkout_form_validate(data, *args, **kwargs)) | ||
|
||
# If it is ``None``, then there is no need to check it | ||
if data.get("accepted_legal_terms") is False: | ||
errors["accepted_legal_terms"] = "missing" | ||
|
||
return errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_sale_require_legal | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: e-commerce (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-07-28 00:48+0000\n" | ||
"PO-Revision-Date: 2016-07-27 02:52+0000\n" | ||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n" | ||
"Language-Team: German (http://www.transifex.com/oca/OCA-e-commerce-8-0/language/de/)\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Language: de\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. module: website_sale_require_legal | ||
#: view:website:website_sale.checkout | ||
msgid "Confirm" | ||
msgstr "Bestätigen" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_sale_require_legal | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: e-commerce (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-07-28 00:48+0000\n" | ||
"PO-Revision-Date: 2016-07-27 02:52+0000\n" | ||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n" | ||
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-e-commerce-8-0/language/es/)\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Language: es\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. module: website_sale_require_legal | ||
#: view:website:website_sale.checkout | ||
msgid "Confirm" | ||
msgstr "Confirmar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_sale_require_legal | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: e-commerce (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-09-17 10:15+0000\n" | ||
"PO-Revision-Date: 2016-10-04 10:07+0000\n" | ||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n" | ||
"Language-Team: Croatian (http://www.transifex.com/oca/OCA-e-commerce-8-0/language/hr/)\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Language: hr\n" | ||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" | ||
|
||
#. module: website_sale_require_legal | ||
#: view:website:website_sale.checkout | ||
msgid "Confirm" | ||
msgstr "Potvrdi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_sale_require_legal | ||
# | ||
# Translators: | ||
# Paolo Valier, 2016 | ||
# Paolo Valier, 2016 | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: e-commerce (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-07-28 00:48+0000\n" | ||
"PO-Revision-Date: 2016-07-27 02:52+0000\n" | ||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n" | ||
"Language-Team: Italian (http://www.transifex.com/oca/OCA-e-commerce-8-0/language/it/)\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Language: it\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. module: website_sale_require_legal | ||
#: view:website:website_sale.checkout | ||
msgid "Confirm" | ||
msgstr "Conferma" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_sale_require_legal | ||
# | ||
# 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-07-28 00:48+0000\n" | ||
"PO-Revision-Date: 2016-07-27 02:52+0000\n" | ||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n" | ||
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-e-commerce-8-0/language/sl/)\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Language: sl\n" | ||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" | ||
|
||
#. module: website_sale_require_legal | ||
#: view:website:website_sale.checkout | ||
msgid "Confirm" | ||
msgstr "Potrjujem" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<template id="checkout" inherit_id="website_sale.checkout"> | ||
<xpath expr="//div[@class='js_shipping row mb16']" position="after"> | ||
<!-- Only shown for public users, out of test mode --> | ||
<div t-if="'TestCursor' not in repr(env.cr)" | ||
class="row"> | ||
<div t-attf-class="form-group col-md-12 | ||
#{error.get('accepted_legal_terms') and | ||
'has-error' or ''}"> | ||
<label for="accepted_legal_terms" class="control-label"> | ||
<input type="checkbox" | ||
name="accepted_legal_terms" | ||
id="accepted_legal_terms" | ||
required="required"/> | ||
<t t-call="website_legal_page.acceptance_full"/> | ||
</label> | ||
</div> | ||
</div> | ||
</xpath> | ||
|
||
<!-- Replace <a> by <button> to trigger HTML5 validations --> | ||
<xpath expr="//a[contains(@class, 'a-submit')]" position="replace"> | ||
<button class="btn btn-primary pull-right mb32"> | ||
Confirm | ||
<span class="fa fa-long-arrow-right"/> | ||
</button> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |