-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD]sale_require_terms_and_conditions
- Loading branch information
Showing
2 changed files
with
120 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,42 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) | ||
# All Rights Reserved. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# 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 for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
{ | ||
'name': 'Sale Require Terms and Conditions', | ||
'version': "16.0.1.0.0", | ||
'category': 'Sales', | ||
'sequence': 14, | ||
'summary': '', | ||
'author': 'ADHOC SA', | ||
'website': 'www.adhoc.com.ar', | ||
'license': 'AGPL-3', | ||
'images': [ | ||
], | ||
'depends': [ | ||
'sale' | ||
], | ||
'data': [ | ||
'views/sale_order_portal_template.xml', | ||
|
||
], | ||
'demo': [], | ||
'installable': True, | ||
'auto_install': False, | ||
'application': False, | ||
} |
78 changes: 78 additions & 0 deletions
78
sale_require_terms_and_conditions/views/sale_order_portal_template.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,78 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<odoo> | ||
<template id="sale_order_portal_template" inherit_id="sale.sale_order_portal_template"> | ||
<xpath expr="//ul[hasclass('list-group')]/li" position="replace"> | ||
<li class="list-group-item flex-grow-1"> | ||
<div class="o_download_pdf btn-toolbar flex-sm-nowrap"> | ||
<div class="btn-group flex-grow-1 mr-1 mb-1"> | ||
<a class="btn btn-secondary btn-block o_download_btn" t-att-href="sale_order.get_portal_url(report_type='pdf', download=True)" title="Download"> | ||
<i class="fa fa-download"/> | ||
Download</a> | ||
</div> | ||
<div class="btn-group flex-grow-1 mb-1"> | ||
<a class="btn btn-secondary btn-block o_print_btn o_portal_invoice_print" t-att-href="sale_order.get_portal_url(report_type='pdf')" id="print_invoice_report" title="Print" target="_blank"> | ||
<i class="fa fa-print"/> | ||
Print</a> | ||
</div> | ||
</div> | ||
</li> | ||
</xpath> | ||
<xpath expr="//div[hasclass('justify-content-center')]/t/div/a" position="attributes"> | ||
<attribute name="id">modalacceptbuttonsign</attribute> | ||
</xpath> | ||
<xpath expr="//div[hasclass('justify-content-center')]/div/a" position="attributes"> | ||
<attribute name="id">o_sale_portal_paynow</attribute> | ||
</xpath> | ||
<xpath expr="//div[hasclass('justify-content-center')]" position="before"> | ||
<t> | ||
<div style="display:flex;flex-direction:column;margin-top:15px" id="tyc_div"> | ||
<span id="tycSpan">Debe aceptar los términos y condiciones para continuar:</span> | ||
<div> | ||
<input style="margin-top:5px" type="checkbox" name="x_accept_tyc" id="x_accept_tyc"/> | ||
<span style="font-weight:bold"> Acepto los Términos y Condiciones</span> | ||
</div> | ||
</div> | ||
</t> | ||
</xpath> | ||
<xpath expr="//div[hasclass('o_portal_sale_sidebar')]" position="after"> | ||
<script> | ||
var tycDiv = document.getElementById("tyc_div"); | ||
var tycSpan = document.getElementById("tycSpan"); | ||
var input = document.getElementById("x_accept_tyc"); | ||
var button = document.getElementById("modalacceptbuttonsign") ? document.getElementById("modalacceptbuttonsign"): document.getElementById("o_sale_portal_paynow"); | ||
var alertSuccess = document.getElementsByClassName("alert-success")[0]; | ||
var alertWarning = document.getElementsByClassName("alert-warning")[0]; | ||
if(button !== null && typeof(alertSuccess) == 'undefined' && typeof(alertWarning) == 'undefined'){ | ||
|
||
button.disabled = true; | ||
button.dataset['bsTarget'] = ""; | ||
button.dataset['bsToggle'] = ""; | ||
button.style.backgroundColor = "#787878"; | ||
button.style.borderColor = "#787878"; | ||
|
||
|
||
input.onclick = function(){ | ||
if(input.checked){ | ||
button.disabled = false; | ||
button.dataset['bsTarget'] = "#modalaccept"; | ||
button.dataset['bsToggle'] = "modal"; | ||
button.style.backgroundColor = ""; | ||
button.style.borderColor = ""; | ||
}else { | ||
button.disabled = true; | ||
button.dataset['bsTarget'] = ""; | ||
button.dataset['bsToggle'] = ""; | ||
button.style.backgroundColor = "#787878"; | ||
button.style.borderColor = "#787878"; | ||
} | ||
}; | ||
}else{ | ||
tycSpan.innerText = "Usted ha aceptado los términos y condiciones"; | ||
input.checked = true; | ||
input.disabled = true; | ||
tycDiv.scrollIntoView({behavior: 'smooth'}) | ||
} | ||
</script> | ||
</xpath> | ||
</template> | ||
</odoo> |