mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_time_range_menu_custom: Migration to 16.0
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/** @odoo-module **/
|
||||
/* Copyright 2024 Tecnativa - Carlos Roca
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
|
||||
import {ComparisonMenu} from "@web/search/comparison_menu/comparison_menu";
|
||||
import {DropdownItemCustomPeriod} from "./date_selector.esm";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
|
||||
patch(ComparisonMenu, "web_time_range_menu_custom.FilterMenu", {
|
||||
components: {
|
||||
...ComparisonMenu.components,
|
||||
DropdownItemCustomPeriod,
|
||||
},
|
||||
});
|
||||
@@ -3,8 +3,7 @@
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
|
||||
import {useBus} from "@web/core/utils/hooks";
|
||||
|
||||
const {Component, QWeb} = owl;
|
||||
const {useState} = owl.hooks;
|
||||
const {Component, useState} = owl;
|
||||
import * as dates from "@web/search/utils/dates";
|
||||
const {DateTime} = luxon; // eslint-disable-line no-undef
|
||||
var ID_CUSTOM_DATE = 0;
|
||||
@@ -120,4 +119,3 @@ DropdownItemCustomPeriod.props = {
|
||||
field: {type: Object, optional: true},
|
||||
comparisonItems: {type: Object, optional: true},
|
||||
};
|
||||
QWeb.registerComponent("DropdownItemCustomPeriod", DropdownItemCustomPeriod);
|
||||
|
||||
@@ -84,9 +84,13 @@ patch(dates, "patch dates", {
|
||||
};
|
||||
if (otherOptions.length) {
|
||||
for (const option of otherOptions) {
|
||||
const year_param =
|
||||
option.granularity === "week"
|
||||
? {weekYear: yearOption.setParam.year}
|
||||
: yearOption.setParam;
|
||||
const setParam = Object.assign(
|
||||
{},
|
||||
yearOption.setParam,
|
||||
year_param,
|
||||
option ? option.setParam : {}
|
||||
);
|
||||
const {granularity, custom_period} = option;
|
||||
|
||||
13
web_time_range_menu_custom/static/src/js/filter_menu.esm.js
Normal file
13
web_time_range_menu_custom/static/src/js/filter_menu.esm.js
Normal file
@@ -0,0 +1,13 @@
|
||||
/** @odoo-module **/
|
||||
/* Copyright 2024 Tecnativa - Carlos Roca
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
|
||||
import {FilterMenu} from "@web/search/filter_menu/filter_menu";
|
||||
import {DropdownItemCustomPeriod} from "./date_selector.esm";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
|
||||
patch(FilterMenu, "web_time_range_menu_custom.FilterMenu", {
|
||||
components: {
|
||||
...FilterMenu.components,
|
||||
DropdownItemCustomPeriod,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user