[MIG] web_pivot_computed_measure: Migration to 16.0

This commit is contained in:
Carlos Roca
2024-02-27 13:18:31 +01:00
parent f45795b24c
commit deae402f2a
12 changed files with 84 additions and 78 deletions

View File

@@ -0,0 +1,26 @@
/** @odoo-module **/
/* Copyright 2024 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
import {PivotController} from "@web/views/pivot/pivot_controller";
import {patch} from "@web/core/utils/patch";
import {DropdownItemCustomMeasure} from "../dropdown_item_custom_measure/dropdown_item_custom_measure.esm";
patch(PivotController.prototype, "web_pivot_computed_measure.PivotController", {
/**
* Add computed_measures to context key to avoid loosing info when saving the
* filter to favorites.
*
* @override
*/
getContext() {
var res = this._super(...arguments);
res.pivot_computed_measures = this.model._computed_measures;
return res;
},
});
PivotController.components = {
...PivotController.components,
DropdownItemCustomMeasure,
};

View File

@@ -4,8 +4,8 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
import {PivotModel} from "@web/views/pivot/pivot_model";
import {patch} from "web.utils";
import {computeReportMeasures} from "@web/views/helpers/utils";
import {patch} from "@web/core/utils/patch";
import {computeReportMeasures} from "@web/views/utils";
import {evalOperation} from "../helpers/utils.esm";
patch(PivotModel.prototype, "web_pivot_computed_measure.PivotModel", {

View File

@@ -3,7 +3,7 @@
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
import {PivotRenderer} from "@web/views/pivot/pivot_renderer";
import {patch} from "web.utils";
import {patch} from "@web/core/utils/patch";
patch(PivotRenderer.prototype, "web_pivot_computed_measure.PivotRenderer", {
getFormattedValue(cell) {

View File

@@ -1,20 +0,0 @@
/** @odoo-module **/
/* Copyright 2022 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
import {PivotView} from "@web/views/pivot/pivot_view";
import {patch} from "web.utils";
patch(PivotView.prototype, "web_pivot_computed_measure.PivotView", {
/**
* Add computed_measures to context key to avoid loosing info when saving the
* filter to favorites.
*
* @override
*/
getContext() {
var res = this._super(...arguments);
res.pivot_computed_measures = this.model._computed_measures;
return res;
},
});