[MIG] web_view_calendar_list: Migration to 13.0

pull/1958/head
Enric Tobella 2021-06-21 16:09:56 +02:00
parent 038588967b
commit 9a941192eb
3 changed files with 12 additions and 19 deletions

View File

@ -5,10 +5,10 @@
"name": "Web View Calendar List", "name": "Web View Calendar List",
"summary": """ "summary": """
Show calendars as a List""", Show calendars as a List""",
"version": "12.0.1.0.0", "version": "13.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Creu Blanca,Odoo Community Association (OCA)", "author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"depends": ["web",], "depends": ["web"],
"data": ["templates/assets.xml",], "data": ["templates/assets.xml"],
} }

View File

@ -34,7 +34,7 @@ odoo.define("web_view_calendar_list.CalendarListRenderer", function(require) {
self.trigger_up("openEvent", event); self.trigger_up("openEvent", event);
self.$calendar.fullCalendar("unselect"); self.$calendar.fullCalendar("unselect");
}, },
select: function(target_date, end_date, event, _js_event, _view) { select: function(target_date, end_date) {
var data = {start: target_date, end: end_date}; var data = {start: target_date, end: end_date};
if (self.state.context.default_name) { if (self.state.context.default_name) {
data.title = self.state.context.default_name; data.title = self.state.context.default_name;
@ -52,9 +52,9 @@ odoo.define("web_view_calendar_list.CalendarListRenderer", function(require) {
var start = event.r_start || event.start; var start = event.r_start || event.start;
var end = event.r_end || event.end; var end = event.r_end || event.end;
var timeFormat = var timeFormat =
_t.database.parameters.time_format.search("%H") != -1 _t.database.parameters.time_format.search("%H") == -1
? "HH:mm" ? "h:mma"
: "h:mma"; : "HH:mm";
display_hour = display_hour =
start.format(timeFormat) + " - " + end.format(timeFormat); start.format(timeFormat) + " - " + end.format(timeFormat);
if (display_hour === "00:00 - 00:00") { if (display_hour === "00:00 - 00:00") {
@ -64,8 +64,8 @@ odoo.define("web_view_calendar_list.CalendarListRenderer", function(require) {
element.find(".fc-list-item-time").text(display_hour); element.find(".fc-list-item-time").text(display_hour);
}, },
// Dirty hack to ensure a correct first render // Dirty hack to ensure a correct first render
eventAfterAllRender: function() { windowResize: function() {
$(window).trigger("resize"); self._render();
}, },
viewRender: function(view) { viewRender: function(view) {
// Compute mode from view.name which is either 'month', // Compute mode from view.name which is either 'month',
@ -88,6 +88,7 @@ odoo.define("web_view_calendar_list.CalendarListRenderer", function(require) {
}, },
height: "parent", height: "parent",
unselectAuto: false, unselectAuto: false,
isRTL: _t.database.parameters.direction === "rtl",
locale: locale, locale: locale,
/* Reset locale when fullcalendar has already been /* Reset locale when fullcalendar has already been
instanciated before now instanciated before now
@ -145,14 +146,6 @@ odoo.define("web_view_calendar_list.CalendarListRenderer", function(require) {
$fc_view.scrollLeft(scrollPosition); $fc_view.scrollLeft(scrollPosition);
var fullWidth = this.state.fullWidth;
this.$(".o_calendar_sidebar_toggler")
.toggleClass("fa-close", !fullWidth)
.toggleClass("fa-chevron-left", fullWidth)
.attr("title", fullWidth ? _("Open Sidebar") : _("Close Sidebar"));
this.$sidebar_container.toggleClass("o_sidebar_hidden", fullWidth);
this.$sidebar.toggleClass("o_hidden", fullWidth);
this._renderFilters(); this._renderFilters();
this.$calendar.appendTo("body"); this.$calendar.appendTo("body");
if (scrollTop) { if (scrollTop) {

View File

@ -13,11 +13,11 @@ odoo.define("web_view_calendar_list.CalendarListView", function(require) {
var CalendarListView = CalendarView.extend({ var CalendarListView = CalendarView.extend({
display_name: _lt("Calendar List"), display_name: _lt("Calendar List"),
icon: "fa-calendar-check-o", icon: "fa-calendar-check-o",
config: { config: _.extend(CalendarView.prototype.config, {
Model: CalendarListModel, Model: CalendarListModel,
Controller: CalendarListController, Controller: CalendarListController,
Renderer: CalendarListRenderer, Renderer: CalendarListRenderer,
}, }),
}); });
view_registry.add("calendar_list", CalendarListView); view_registry.add("calendar_list", CalendarListView);