[MERGE] calendar: add link to join video call

This commit adds a link to each calendar.event to join a video call
hosted on Jitsi.

TaskID: 2367543

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#61280

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Odoo's Mergebot
2020-12-09 12:05:28 +01:00
committed by GitHub
10 changed files with 65 additions and 3 deletions
@@ -77,6 +77,9 @@
</li>
% endfor
</ul></li>
% if object.event_id.videocall_location:
<li>Join Video Call: <a href="${object.event_id.videocall_location}" target="_blank">${object.event_id.videocall_location}</a></li>
% endif
</ul>
</td>
</tr></table>
@@ -168,6 +171,9 @@
</li>
% endfor
</ul></li>
% if object.event_id.videocall_location:
<li>Join Video Call: <a href="${object.event_id.videocall_location}" target="_blank">${object.event_id.videocall_location}</a></li>
% endif
</ul>
</td>
</tr></table>
@@ -257,6 +263,9 @@
</li>
% endfor
</ul></li>
% if object.event_id.videocall_location:
<li>Join Video Call: <a href="${object.event_id.videocall_location}" target="_blank">${object.event_id.videocall_location}</a></li>
% endif
</ul>
</td>
</tr></table>
+12
View File
@@ -3,9 +3,11 @@
from datetime import timedelta
import math
from uuid import uuid4
import babel.dates
import logging
import pytz
from werkzeug.urls import url_join
from odoo import api, fields, models
from odoo import tools
@@ -78,6 +80,15 @@ class Meeting(models.Model):
partners |= self.env['res.partner'].browse(active_id)
return partners
@api.model
def _default_videocall_location(self):
if self.env.context.get('calendar_no_videocall'):
return False
jitsi_url = self.env['ir.config_parameter'].sudo().get_param('website_jitsi.jitsi_server_domain', 'meet.jit.si')
if not jitsi_url.startswith('http'):
jitsi_url = 'https://' + jitsi_url
return url_join(jitsi_url, 'odoo-%s' % (uuid4().hex[:12]))
def _find_my_attendee(self):
""" Return the first attendee where the user connected has been invited
from all the meeting_ids in parameters.
@@ -211,6 +222,7 @@ class Meeting(models.Model):
('confidential', 'Only internal users')],
'Privacy', default='public', required=True)
location = fields.Char('Location', tracking=True, help="Location of Event")
videocall_location = fields.Char('Join Video Call', default=_default_videocall_location)
show_as = fields.Selection(
[('free', 'Available'),
('busy', 'Busy')], 'Show Time as', default='busy', required=True)
@@ -68,3 +68,12 @@
font-weight: bold;
}
}
.o_cw_body .o_field_copy {
max-width: calc(100% - 6rem);
width: unset !important;
}
.o_cw_body .o_clipboard_button {
padding-top: 0px !important;
}
+6
View File
@@ -112,6 +112,11 @@
class="oe_inline"/>
</h2>
</div>
<group>
<group>
<field name="videocall_location" string="Join Video Call" widget="CopyClipboardURL" attrs="{'invisible': [('videocall_location', '=', False)]}" />
</group>
</group>
<notebook>
<page name="page_details" string="Meeting Details">
<group>
@@ -255,6 +260,7 @@
event_open_popup="true"
event_limit="5"
color="user_id">
<field name="videocall_location" string="Join Video Call" widget="CopyClipboardURL" />
<field name="attendee_status"/>
<field name="user_id" string="Responsible" filters="1" widget="many2one_avatar_user"/>
<field name="partner_ids" widget="many2manyattendee" write_model="calendar.contacts" write_field="partner_id" avatar_field="image_128"/>
+1
View File
@@ -869,6 +869,7 @@ class HolidaysRequest(models.Model):
meeting_values = meeting_holidays._prepare_holidays_meeting_values()
meetings = self.env['calendar.event'].with_context(
no_mail_to_attendees=True,
calendar_no_videocall=True,
active_model=self._name
).create(meeting_values)
for holiday, meeting in zip(meeting_holidays, meetings):
@@ -1750,6 +1750,23 @@ var CharCopyClipboard = FieldChar.extend(CopyClipboard, {
className: 'o_field_copy o_text_overflow',
});
var URLCopyClipboard = FieldChar.extend(CopyClipboard, {
description: _lt("Copy to Clipboard"),
clipboardTemplate: 'CopyClipboardChar',
className: 'o_field_copy o_text_overflow o_field_copy_url',
events: _.extend({}, FieldChar.prototype.events, {
'click': '_onClick',
}),
_onClick: function(ev) {
if(ev.target.className.includes('o_field_copy_url')) {
ev.stopPropagation();
window.open(this.value, '_blank');
}
}
});
var AbstractFieldBinary = AbstractField.extend({
events: _.extend({}, AbstractField.prototype.events, {
'change .o_input_file': 'on_file_change',
@@ -3756,6 +3773,7 @@ return {
UrlWidget: UrlWidget,
TextCopyClipboard: TextCopyClipboard,
CharCopyClipboard: CharCopyClipboard,
URLCopyClipboard: URLCopyClipboard,
JournalDashboardGraph: JournalDashboardGraph,
AceEditor: AceEditor,
FieldColor: FieldColor,
@@ -42,6 +42,7 @@ registry
.add('url', basic_fields.UrlWidget)
.add('CopyClipboardText', basic_fields.TextCopyClipboard)
.add('CopyClipboardChar', basic_fields.CharCopyClipboard)
.add('CopyClipboardURL', basic_fields.URLCopyClipboard)
.add('image', basic_fields.FieldBinaryImage)
.add('image_url', basic_fields.CharImageUrl)
.add('kanban.image', basic_fields.KanbanFieldBinaryImage)
+5 -1
View File
@@ -470,7 +470,7 @@
color: $o-brand-primary;
font-weight: $badge-font-weight;
text-align: center;
padding-right: 100px;
padding-right: 6rem;
word-break: break-word;
.o_clipboard_button {
@include o-position-absolute($top: 0, $right: 0);
@@ -484,6 +484,10 @@
height: 100%;
}
}
&.o_field_copy_url {
cursor: pointer;
padding-left: 3px;
}
}
& > .o_field_color {
@@ -687,6 +687,8 @@ $o-cw-filter-avatar-size: 20px;
.o_cw_popover_fields_secondary {
max-height: 170px; // Fallback for old browsers
max-height: 25vh;
overflow: auto;
padding-bottom: 1px; // prevents the scrollbar to show when not needed
&::-webkit-scrollbar {
background: gray('200');
+2 -2
View File
@@ -1405,12 +1405,12 @@
</t>
<t t-name="CopyClipboardText">
<button class="btn btn-sm btn-primary o_clipboard_button o_btn_text_copy">
<span class="fa fa-clipboard"></span><span> Copy Text</span>
<span class="fa fa-clipboard"></span><span> Copy</span>
</button>
</t>
<t t-name="CopyClipboardChar">
<button class="btn btn-sm btn-primary o_clipboard_button o_btn_char_copy">
<span class="fa fa-clipboard"></span><span> Copy Text</span>
<span class="fa fa-clipboard"></span><span> Copy</span>
</button>
</t>
<t t-name="FieldBinaryFile">