summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2015-11-27 13:14:47 +0100
committerqsm-odoo <qsm@odoo.com>2015-11-27 16:20:32 +0100
commitbba2e39fb8a4443eb80c570bf8b8984b64f6fe7c (patch)
tree9e2ffaa22f78ee8b00540e8b4c00d89c30f486ff /addons
parent2790bb4492cdca3b1aed4fb16989b165d6ad45d4 (diff)
[FIX] calendar: redirection after invitation email
When accepting/declining a calendar event invitation received by mail, we landed on an empty gray webclient. The confirmation page had been dropped with passage to new JS API / new calendar / new webclient. Previous mechanism had been reimplemented: custom web client with event information/confirmation if the user is not connected or redirection to the event form view if the user is connected. + FIX manyattendeetag : the status circle did not turn red when an user declined the invitation.
Diffstat (limited to 'addons')
-rw-r--r--addons/calendar/controllers/main.py8
-rw-r--r--addons/calendar/static/src/js/base_calendar.js15
-rw-r--r--addons/calendar/static/src/less/calendar.less41
-rw-r--r--addons/calendar/static/src/xml/base_calendar.xml37
4 files changed, 100 insertions, 1 deletions
diff --git a/addons/calendar/controllers/main.py b/addons/calendar/controllers/main.py
index 770c73bd41c..afe85209f03 100644
--- a/addons/calendar/controllers/main.py
+++ b/addons/calendar/controllers/main.py
@@ -48,7 +48,13 @@ class meeting_invitation(http.Controller):
if attendee:
attendee_data['current_attendee'] = attendee[0]
- values = dict(init="s.calendar.event('%s', '%s', '%s', '%s' , '%s');" % (db, action, id, 'form', json.dumps(attendee_data)))
+ values = dict(
+ init = """
+ odoo.define('calendar.invitation_page', function (require) {
+ require('base_calendar.base_calendar').showCalendarInvitation('%s', '%s', '%s', '%s', '%s');
+ });
+ """ % (db, action, id, 'form', json.dumps(attendee_data))
+ )
return request.render('web.webclient_bootstrap', values)
# Function used, in RPC to check every 5 minutes, if notification to do for an event or not
diff --git a/addons/calendar/static/src/js/base_calendar.js b/addons/calendar/static/src/js/base_calendar.js
index 7139a0d61d1..b28f6308328 100644
--- a/addons/calendar/static/src/js/base_calendar.js
+++ b/addons/calendar/static/src/js/base_calendar.js
@@ -8,6 +8,7 @@ var Dialog = require('web.Dialog');
var form_common = require('web.form_common');
var Model = require('web.DataModel');
var Notification = require('web.notification').Notification;
+var session = require('web.session');
var WebClient = require('web.WebClient');
var widgets = require('web_calendar.widgets');
@@ -252,6 +253,20 @@ var Many2ManyAttendee = FieldMany2ManyTags.extend({
}
});
+function showCalendarInvitation(db, action, id, view, attendee_data) {
+ session.session_bind(session.origin).then(function () {
+ if (session.session_is_valid(db) && session.username !== "anonymous") {
+ window.location.href = _.str.sprintf('/web?db=%s#id=%s&view_type=form&model=calendar.event', db, id);
+ } else {
+ $("body").prepend(QWeb.render('CalendarInvitation', {attendee_data: JSON.parse(attendee_data)}));
+ }
+ });
+}
+
core.form_widget_registry.add('many2manyattendee', Many2ManyAttendee);
+return {
+ showCalendarInvitation: showCalendarInvitation,
+};
+
});
diff --git a/addons/calendar/static/src/less/calendar.less b/addons/calendar/static/src/less/calendar.less
index b531a583145..e3c15136a00 100644
--- a/addons/calendar/static/src/less/calendar.less
+++ b/addons/calendar/static/src/less/calendar.less
@@ -35,6 +35,10 @@
&.needsAction {
background-color: @odoo-brand-secondary;
}
+
+ &.declined {
+ background-color: @brand-danger;
+ }
}
.o_calendar_all_responsibles {
@@ -60,3 +64,40 @@
margin-top: 10px;
position: relative;
}
+
+.o_calendar_invitation_page {
+ .o-flex(0, 0, auto);
+ width: 50%;
+ margin: 30px auto 0;
+ .o-webclient-padding(@top: 10px, @bottom: 10px);
+ background-color: @odoo-view-background-color;
+
+ .o_logo {
+ width: 15%;
+ }
+ .o_event_title {
+ margin-left: 20%;
+
+ h2 {
+ margin-top: 0;
+ }
+ }
+ .o_event_table {
+ clear: both;
+ margin: 15px 0 0;
+
+ th {
+ padding-right: 15px;
+ }
+ ul {
+ padding-left: 0;
+ }
+ }
+
+ .o_accepted {
+ color: @brand-success;
+ }
+ .o_declined {
+ color: @brand-danger;
+ }
+}
diff --git a/addons/calendar/static/src/xml/base_calendar.xml b/addons/calendar/static/src/xml/base_calendar.xml
index e4dd5eca511..d01994de2e5 100644
--- a/addons/calendar/static/src/xml/base_calendar.xml
+++ b/addons/calendar/static/src/xml/base_calendar.xml
@@ -27,4 +27,41 @@
</t>
</t>
</t>
+
+ <div t-name="CalendarInvitation" class="o_calendar_invitation_page">
+ <div class="pull-right">
+ <t t-esc="attendee_data['current_attendee'].cn"/> (<t t-esc="attendee_data['current_attendee'].email"/>)
+ <div t-if="attendee_data['current_attendee'].state !== 'needsAction'" t-attf-class="o_#{attendee_data['current_attendee'].state}">
+ <t t-if="attendee_data['current_attendee'].state === 'accepted'">Yes I'm going.</t>
+ <t t-if="attendee_data['current_attendee'].state === 'declined'">No I'm not going.</t>
+ </div>
+ </div>
+ <div class="pull-left o_logo">
+ <img class="img img-responsive" src='/web/binary/company_logo'/>
+ </div>
+ <div class="o_event_title">
+ <h2>Calendar Invitation</h2>
+ <h3><t t-esc="attendee_data['meeting'].event"/></h3>
+ </div>
+ <table class="o_event_table table table-striped">
+ <tr>
+ <th>When</th>
+ <td><t t-esc="attendee_data['meeting'].when"/></td>
+ </tr>
+ <tr>
+ <th>Where</th>
+ <td><t t-esc="attendee_data['meeting'].where or '-'"/></td>
+ </tr>
+ <tr>
+ <th>Who</th>
+ <td>
+ <ul>
+ <li t-foreach="attendee_data['attendee']" t-as="attendee" t-attf-class="o_#{attendee.status}">
+ <t t-esc="attendee.name"/>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ </table>
+ </div>
</template>