Skip to content

Commit

Permalink
[ADD] website_event_legal_acceptance
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Iniesta committed Apr 17, 2015
1 parent 17d237c commit 3160fb9
Show file tree
Hide file tree
Showing 13 changed files with 313 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website_event_legal_acceptance/README.rst
@@ -0,0 +1,4 @@
Website Legal Acceptance
========================

Add legal acceptance to events.
27 changes: 27 additions & 0 deletions website_event_legal_acceptance/__init__.py
@@ -0,0 +1,27 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright :
# (c) 2014 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
# Endika Iglesias <endikaig@antiun.com>
# Antonio Espinosa <antonioea@antiun.com>
# Javier Iniesta <javieria@antiun.com>
# Daniel Gómez-Zurita <danielgz@antiun.com>
#
# 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/>.
#
##############################################################################

from . import models
47 changes: 47 additions & 0 deletions website_event_legal_acceptance/__openerp__.py
@@ -0,0 +1,47 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright :
# (c) 2014 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
# Endika Iglesias <endikaig@antiun.com>
# Antonio Espinosa <antonioea@antiun.com>
# Javier Iniesta <javieria@antiun.com>
# Daniel Gómez-Zurita <danielgz@antiun.com>
# Copyright (c) 2015 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
#
# 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': "Website Legal Acceptance",
'category': 'Tools',
'version': '1.0',
'depends': [
'website_event',
],
'data': [
'views/assets.xml',
'views/templates.xml',
'views/event_event_view.xml',
'security/ir.model.access.csv',
],
'author': 'Antiun Ingenieria S.L., '
'Serv. Tecnol. Avanzados - Pedro M. Baeza',
'website': 'http://www.antiun.com',
'license': 'AGPL-3',
'installable': True,
}
31 changes: 31 additions & 0 deletions website_event_legal_acceptance/i18n/es.po
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_legal_acceptance
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-02-10 09:57+0000\n"
"PO-Revision-Date: 2015-02-10 09:57+0000\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"

#. module: website_event_legal_acceptance
#: field:event.legal.template,name:0
msgid "Name"
msgstr "Título"

#. module: website_event_legal_acceptance
#: field:event.legal.template,description:0
msgid "Content"
msgstr "Contenido"

#. module: website_event_legal_acceptance
#: field:event.event,legal_acceptance:0
msgid "Legal acceptance"
msgstr "Bases legales"
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_legal_acceptance
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-02-10 09:57+0000\n"
"PO-Revision-Date: 2015-02-10 09:57+0000\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"

#. module: website_event_legal_acceptance
#: field:event.legal.template,name:0
msgid "Name"
msgstr ""

#. module: website_event_legal_acceptance
#: field:event.legal.template,description:0
msgid "Content"
msgstr ""

#. module: website_event_legal_acceptance
#: field:event.event,legal_acceptance:0
msgid "Legal acceptance"
msgstr ""
27 changes: 27 additions & 0 deletions website_event_legal_acceptance/models/__init__.py
@@ -0,0 +1,27 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright :
# (c) 2014 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
# Endika Iglesias <endikaig@antiun.com>
# Antonio Espinosa <antonioea@antiun.com>
# Javier Iniesta <javieria@antiun.com>
# Daniel Gómez-Zurita <danielgz@antiun.com>
#
# 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/>.
#
##############################################################################

from . import event_event
41 changes: 41 additions & 0 deletions website_event_legal_acceptance/models/event_event.py
@@ -0,0 +1,41 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright :
# (c) 2014 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
# Endika Iglesias <endikaig@antiun.com>
# Antonio Espinosa <antonioea@antiun.com>
# Javier Iniesta <javieria@antiun.com>
# Daniel Gómez-Zurita <danielgz@antiun.com>
#
# 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/>.
#
##############################################################################

from openerp import models, fields


class EventLegalAcceptance(models.Model):
_name = 'event.legal.template'

name = fields.Char(string='Name')
description = fields.Html(string='Description')


class EventEvent(models.Model):
_inherit = "event.event"

legal_acceptance = fields.Many2one(
comodel_name='event.legal.template', string='Legal acceptance')
4 changes: 4 additions & 0 deletions website_event_legal_acceptance/security/ir.model.access.csv
@@ -0,0 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_event_legal_template_manager,access_event_legal_template_manager,model_event_legal_template,event.group_event_manager,1,1,1,1
access_event_legal_template_user,access_event_legal_template_user,model_event_legal_template,event.group_event_user,1,0,0,0
access_event_legal_template_public,access_event_legal_template_public,model_event_legal_template,base.group_public,1,0,0,0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions website_event_legal_acceptance/static/src/js/legal_acceptance.js
@@ -0,0 +1,23 @@
(function($) {
"use strict";

$(document).ready(function() {

$('form').submit(function (e) {

if($('#bases-legales').length != 0) {

if($('#bases-legales').is(':checked')) {

} else {
e.preventDefault();
alert("Por favor, antes de continuar, debes leer y aceptar las bases legales");
}

}

});

});

})(jQuery);
9 changes: 9 additions & 0 deletions website_event_legal_acceptance/views/assets.xml
@@ -0,0 +1,9 @@
<openerp><data>

<template id="modal_legal_advice_assets" inherit_id="website.assets_frontend" name="Bases Legales JS">
<xpath expr="." position="inside">
<script type="text/javascript" src="/website_event_legal_acceptance/static/src/js/legal_acceptance.js"/>
</xpath>
</template>

</data></openerp>
47 changes: 47 additions & 0 deletions website_event_legal_acceptance/views/event_event_view.xml
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record id="website_event_legal_acceptance_form" model="ir.ui.view">
<field name="name">Bases legales: form</field>
<field name="model">event.legal.template</field>
<field name="arch" type="xml">
<form>
<sheet>
<label for="name"/> <field name="name"/>
<hr/>
<label for="description"/>
<field name="description"/>
</sheet>
</form>
</field>
</record>

<record id="action_website_event_legal_acceptance" model="ir.actions.act_window">
<field name="name">Bases legales</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">event.legal.template</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help">Create and manage legal acceptance texts.</field>
</record>


<menuitem name="Bases legales"
id="menu_legal_acceptance"
action="action_website_event_legal_acceptance"
parent="event.event_main_menu" />

<record id="view_event_event_form" model="ir.ui.view">
<field name="name">view_event_event_form</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<field name="type" position="after">
<field name="legal_acceptance"/>
</field>
</field>
</record>

</data>
</openerp>
22 changes: 22 additions & 0 deletions website_event_legal_acceptance/views/templates.xml
@@ -0,0 +1,22 @@
<openerp><data>

<template id="frontend_legal_acceptance">
<div class="modal fade" id="basesModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
<h4 class="modal-title">Bases legales</h4>
</div>
<div class="modal-body">
<span t-field="event.legal_acceptance.description"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-warning pull-right" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
</template>

</data></openerp>

0 comments on commit 3160fb9

Please sign in to comment.