Skip to content

Commit

Permalink
[MIG] web_pivot_computed_measure: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosRoca13 committed Feb 28, 2024
1 parent 1ea97cc commit 8bf89cf
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 51 deletions.
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
odoo-test-helper
22 changes: 15 additions & 7 deletions web_pivot_computed_measure/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Web Pivot Computed Measure
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:34691d378ce32fade67311831059070fab3df66f5cb2ec7fa88287018b85de7b
!! source digest: sha256:4cef60dd775467b756ccbacb8c215bba0bc74fd32e1917c8b15c3be9de6302a1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Web Pivot Computed Measure
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/15.0/web_pivot_computed_measure
:target: https://github.com/OCA/web/tree/16.0/web_pivot_computed_measure
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_pivot_computed_measure
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_pivot_computed_measure
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -68,15 +68,15 @@ Known issues / Roadmap
======================

#. Add support to define a style for a computed measure (ex. colored)
#. Use t-model to data-binding instad of jquery selectors
#. Use t-model to data-binding instead of jquery selectors

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_pivot_computed_measure%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_pivot_computed_measure%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -111,6 +111,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_pivot_computed_measure>`_ project on GitHub.
.. |maintainer-CarlosRoca13| image:: https://github.com/CarlosRoca13.png?size=40px
:target: https://github.com/CarlosRoca13
:alt: CarlosRoca13

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-CarlosRoca13|

This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_pivot_computed_measure>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
7 changes: 3 additions & 4 deletions web_pivot_computed_measure/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
{
"name": "Web Pivot Computed Measure",
"category": "web",
"version": "15.0.1.0.3",
"version": "16.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"auto_install": False,
"installable": True,
"maintainers": ["CarlosRoca13"],
"assets": {
"web.assets_qweb": [
"/web_pivot_computed_measure/static/src/**/*.xml",
],
"web.assets_backend": [
"/web_pivot_computed_measure/static/src/**/*.esm.js",
"/web_pivot_computed_measure/static/src/**/*.scss",
("remove", "/web_pivot_computed_measure/static/src/test/*.esm.js"),
"/web_pivot_computed_measure/static/src/**/*.xml",
],
"web.assets_tests": [
"/web_pivot_computed_measure/static/src/test/test.esm.js",
Expand Down
2 changes: 1 addition & 1 deletion web_pivot_computed_measure/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#. Add support to define a style for a computed measure (ex. colored)
#. Use t-model to data-binding instad of jquery selectors
#. Use t-model to data-binding instead of jquery selectors
12 changes: 7 additions & 5 deletions web_pivot_computed_measure/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Web Pivot Computed Measure</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:34691d378ce32fade67311831059070fab3df66f5cb2ec7fa88287018b85de7b
!! source digest: sha256:4cef60dd775467b756ccbacb8c215bba0bc74fd32e1917c8b15c3be9de6302a1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/15.0/web_pivot_computed_measure"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_pivot_computed_measure"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/16.0/web_pivot_computed_measure"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_pivot_computed_measure"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Adds support for computed measures on the pivot view.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -434,15 +434,15 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<ol class="arabic simple">
<li>Add support to define a style for a computed measure (ex. colored)</li>
<li>Use t-model to data-binding instad of jquery selectors</li>
<li>Use t-model to data-binding instead of jquery selectors</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_pivot_computed_measure%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_pivot_computed_measure%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -472,7 +472,9 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_pivot_computed_measure">OCA/web</a> project on GitHub.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/CarlosRoca13"><img alt="CarlosRoca13" src="https://github.com/CarlosRoca13.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_pivot_computed_measure">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
/* Copyright 2022 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */

const {Component, QWeb} = owl;
const {useState} = owl.hooks;
import {Component, useState} from "@odoo/owl";

/**
* @extends Component
Expand Down Expand Up @@ -48,4 +47,3 @@ DropdownItemCustomMeasure.props = {
// uses Measures like the graph view.
model: Object,
};
QWeb.registerComponent("DropdownItemCustomMeasure", DropdownItemCustomMeasure);
Original file line number Diff line number Diff line change
@@ -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,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
20 changes: 0 additions & 20 deletions web_pivot_computed_measure/static/src/pivot/pivot_view.esm.js

This file was deleted.

6 changes: 4 additions & 2 deletions web_pivot_computed_measure/static/src/test/test.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ tour.register(
test: true,
},
[
tour.stepUtils.showAppsMenuItem(),
{
trigger: 'a[data-menu-xmlid="base.menu_administration"]',
trigger: ".o_navbar_apps_menu button",
},
{
trigger: '.o_app[data-menu-xmlid="base.menu_administration"]',
},
{
trigger: 'button[data-menu-xmlid="base.menu_users"]',
Expand Down
10 changes: 4 additions & 6 deletions web_pivot_computed_measure/static/src/view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
<div role="separator" class="dropdown-divider" t-if="add_computed_measures" />
<t t-foreach="measures" t-as="measure" t-key="measure_value.name">
<DropdownItem
class="{ o_menu_item: true, selected: activeMeasures.includes(measure) }"
t-if="add_computed_measures and measure.startsWith('__computed_')"
class="o_menu_item dropdown-item"
t-att-class="{ selected: activeMeasures.includes(measure) }"
payload="{ measure: measure_value.name }"
t-esc="measures[measure].string"
parentClosingMode="'none'"
>
<t t-esc="measures[measure].string" />
</DropdownItem>
onSelected="() => this.onMeasureSelected({ measure: measure_value.name })"
/>
</t>
<DropdownItemCustomMeasure
measures="measures"
Expand Down

0 comments on commit 8bf89cf

Please sign in to comment.