[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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user