From 31cbc5b67920ccbec462710d01b93921d1d73550 Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Tue, 26 Nov 2024 14:09:12 +0100 Subject: [PATCH] [IMP] web_pivot_computed_measure: pre-commit auto fixes --- web_pivot_computed_measure/README.rst | 83 +++++++++++-------- web_pivot_computed_measure/pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 5 ++ .../readme/CONTRIBUTORS.rst | 6 -- .../{DESCRIPTION.rst => DESCRIPTION.md} | 0 web_pivot_computed_measure/readme/ROADMAP.md | 2 + web_pivot_computed_measure/readme/ROADMAP.rst | 2 - web_pivot_computed_measure/readme/USAGE.md | 33 ++++++++ web_pivot_computed_measure/readme/USAGE.rst | 25 ------ .../static/description/index.html | 71 ++++++++-------- .../dropdown_item_custom_measure.xml | 8 +- .../static/src/pivot/pivot_model.esm.js | 2 +- .../static/src/pivot/pivot_view.xml | 10 +-- .../static/src/view.xml | 22 +++-- 14 files changed, 148 insertions(+), 124 deletions(-) create mode 100644 web_pivot_computed_measure/pyproject.toml create mode 100644 web_pivot_computed_measure/readme/CONTRIBUTORS.md delete mode 100644 web_pivot_computed_measure/readme/CONTRIBUTORS.rst rename web_pivot_computed_measure/readme/{DESCRIPTION.rst => DESCRIPTION.md} (100%) create mode 100644 web_pivot_computed_measure/readme/ROADMAP.md delete mode 100644 web_pivot_computed_measure/readme/ROADMAP.rst create mode 100644 web_pivot_computed_measure/readme/USAGE.md delete mode 100644 web_pivot_computed_measure/readme/USAGE.rst diff --git a/web_pivot_computed_measure/README.rst b/web_pivot_computed_measure/README.rst index 1b03b9796..9336d644f 100644 --- a/web_pivot_computed_measure/README.rst +++ b/web_pivot_computed_measure/README.rst @@ -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/16.0/web_pivot_computed_measure + :target: https://github.com/OCA/web/tree/18.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-16-0/web-16-0-web_pivot_computed_measure + :target: https://translation.odoo-community.org/projects/web-18-0/web-18-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=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -38,37 +38,48 @@ Adds support for computed measures on the pivot view. Usage ===== -Go to pivot view and click on the "Measures" menu, you will see -a new option called 'Computed Measure'. +Go to pivot view and click on the "Measures" menu, you will see a new +option called 'Computed Measure'. You have the follow options to create a 'computed measure': - - Measure 1: Used in 'operation formula' as 'm1' - - Measure 2: Used in 'operation formula' as 'm2' - - Operation: The formula - - Sum: m1 + m2 - - Sub: m1 - m2 - - Mult: m1 * m2 - - Div: m1 / m2 (Format: Float) - - Perc m1 / m2 (Format: Percentage) - - Custom: Special option only visible in debug mode to write a custom formula. - - Name: The name of the new measure (emtpy = auto-generated) - - Format: How will the value be printed - - Integer - - Float - - Percentage (value * 100) - - Formula*: Custom operation formula - These formula is evaluated using 'PY.eval' -These computed measures can be mixed (You can reuse it to make new computed measures) and saved as favorites. +- Measure 1: Used in 'operation formula' as 'm1' -Notice that "measures/computed measures" involved in an active 'computed measure' -can't be deactivated until you have deactivate the 'computed measure'. +- Measure 2: Used in 'operation formula' as 'm2' + +- Operation: The formula + + - Sum: m1 + m2 + - Sub: m1 - m2 + - Mult: m1 \* m2 + - Div: m1 / m2 (Format: Float) + - Perc m1 / m2 (Format: Percentage) + - Custom: Special option only visible in debug mode to write a + custom formula. + +- Name: The name of the new measure (emtpy = auto-generated) + +- Format: How will the value be printed + + - Integer + - Float + - Percentage (value \* 100) + +- | Formula\*: Custom operation formula + | These formula is evaluated using 'PY.eval' + +These computed measures can be mixed (You can reuse it to make new +computed measures) and saved as favorites. + +Notice that "measures/computed measures" involved in an active 'computed +measure' can't be deactivated until you have deactivate the 'computed +measure'. Known issues / Roadmap ====================== -#. Add support to define a style for a computed measure (ex. colored) -#. Use t-model to data-binding instead of jquery selectors +1. Add support to define a style for a computed measure (ex. colored) +2. Use t-model to data-binding instead of jquery selectors Bug Tracker =========== @@ -76,7 +87,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -84,22 +95,22 @@ Credits ======= Authors -~~~~~~~ +------- * Tecnativa Contributors -~~~~~~~~~~~~ +------------ -* `Tecnativa `_: +- `Tecnativa `__: - * Alexandre D. Díaz - * Pedro M. Baeza - * Ernesto Tejeda - * Carlos Roca + - Alexandre D. Díaz + - Pedro M. Baeza + - Ernesto Tejeda + - Carlos Roca Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -119,6 +130,6 @@ Current `maintainer `__: |maintainer-CarlosRoca13| -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_pivot_computed_measure/pyproject.toml b/web_pivot_computed_measure/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/web_pivot_computed_measure/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_pivot_computed_measure/readme/CONTRIBUTORS.md b/web_pivot_computed_measure/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..5d3768b54 --- /dev/null +++ b/web_pivot_computed_measure/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- [Tecnativa](https://www.tecnativa.com/): + - Alexandre D. Díaz + - Pedro M. Baeza + - Ernesto Tejeda + - Carlos Roca diff --git a/web_pivot_computed_measure/readme/CONTRIBUTORS.rst b/web_pivot_computed_measure/readme/CONTRIBUTORS.rst deleted file mode 100644 index 52470bff0..000000000 --- a/web_pivot_computed_measure/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,6 +0,0 @@ -* `Tecnativa `_: - - * Alexandre D. Díaz - * Pedro M. Baeza - * Ernesto Tejeda - * Carlos Roca diff --git a/web_pivot_computed_measure/readme/DESCRIPTION.rst b/web_pivot_computed_measure/readme/DESCRIPTION.md similarity index 100% rename from web_pivot_computed_measure/readme/DESCRIPTION.rst rename to web_pivot_computed_measure/readme/DESCRIPTION.md diff --git a/web_pivot_computed_measure/readme/ROADMAP.md b/web_pivot_computed_measure/readme/ROADMAP.md new file mode 100644 index 000000000..85f66b51d --- /dev/null +++ b/web_pivot_computed_measure/readme/ROADMAP.md @@ -0,0 +1,2 @@ +1. Add support to define a style for a computed measure (ex. colored) +2. Use t-model to data-binding instead of jquery selectors diff --git a/web_pivot_computed_measure/readme/ROADMAP.rst b/web_pivot_computed_measure/readme/ROADMAP.rst deleted file mode 100644 index 8e4604028..000000000 --- a/web_pivot_computed_measure/readme/ROADMAP.rst +++ /dev/null @@ -1,2 +0,0 @@ -#. Add support to define a style for a computed measure (ex. colored) -#. Use t-model to data-binding instead of jquery selectors diff --git a/web_pivot_computed_measure/readme/USAGE.md b/web_pivot_computed_measure/readme/USAGE.md new file mode 100644 index 000000000..18e370c4e --- /dev/null +++ b/web_pivot_computed_measure/readme/USAGE.md @@ -0,0 +1,33 @@ +Go to pivot view and click on the "Measures" menu, you will see a new +option called 'Computed Measure'. + +You have the follow options to create a 'computed measure': +- Measure 1: Used in 'operation formula' as 'm1' + +- Measure 2: Used in 'operation formula' as 'm2' + +- Operation: The formula + - Sum: m1 + m2 + - Sub: m1 - m2 + - Mult: m1 \* m2 + - Div: m1 / m2 (Format: Float) + - Perc m1 / m2 (Format: Percentage) + - Custom: Special option only visible in debug mode to write a custom + formula. + +- Name: The name of the new measure (emtpy = auto-generated) + +- Format: How will the value be printed + - Integer + - Float + - Percentage (value \* 100) + +- Formula\*: Custom operation formula + These formula is evaluated using 'PY.eval' + +These computed measures can be mixed (You can reuse it to make new +computed measures) and saved as favorites. + +Notice that "measures/computed measures" involved in an active 'computed +measure' can't be deactivated until you have deactivate the 'computed +measure'. diff --git a/web_pivot_computed_measure/readme/USAGE.rst b/web_pivot_computed_measure/readme/USAGE.rst deleted file mode 100644 index 02f354433..000000000 --- a/web_pivot_computed_measure/readme/USAGE.rst +++ /dev/null @@ -1,25 +0,0 @@ -Go to pivot view and click on the "Measures" menu, you will see -a new option called 'Computed Measure'. - -You have the follow options to create a 'computed measure': - - Measure 1: Used in 'operation formula' as 'm1' - - Measure 2: Used in 'operation formula' as 'm2' - - Operation: The formula - - Sum: m1 + m2 - - Sub: m1 - m2 - - Mult: m1 * m2 - - Div: m1 / m2 (Format: Float) - - Perc m1 / m2 (Format: Percentage) - - Custom: Special option only visible in debug mode to write a custom formula. - - Name: The name of the new measure (emtpy = auto-generated) - - Format: How will the value be printed - - Integer - - Float - - Percentage (value * 100) - - Formula*: Custom operation formula - These formula is evaluated using 'PY.eval' - -These computed measures can be mixed (You can reuse it to make new computed measures) and saved as favorites. - -Notice that "measures/computed measures" involved in an active 'computed measure' -can't be deactivated until you have deactivate the 'computed measure'. diff --git a/web_pivot_computed_measure/static/description/index.html b/web_pivot_computed_measure/static/description/index.html index 7353f3434..076a3b6d7 100644 --- a/web_pivot_computed_measure/static/description/index.html +++ b/web_pivot_computed_measure/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,7 +369,7 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:4cef60dd775467b756ccbacb8c215bba0bc74fd32e1917c8b15c3be9de6302a1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

Adds support for computed measures on the pivot view.

Table of contents

@@ -387,48 +387,45 @@ ul.auto-toc {

Usage

-

Go to pivot view and click on the “Measures” menu, you will see -a new option called ‘Computed Measure’.

-
-
You have the follow options to create a ‘computed measure’:
-
    -
  • Measure 1: Used in ‘operation formula’ as ‘m1’
  • -
  • Measure 2: Used in ‘operation formula’ as ‘m2’
  • -
  • -
    Operation: The formula
    -
      +

      Go to pivot view and click on the “Measures” menu, you will see a new +option called ‘Computed Measure’.

      +

      You have the follow options to create a ‘computed measure’:

      +
        +
      • Measure 1: Used in ‘operation formula’ as ‘m1’

        +
      • +
      • Measure 2: Used in ‘operation formula’ as ‘m2’

        +
      • +
      • Operation: The formula

        +
        • Sum: m1 + m2
        • Sub: m1 - m2
        • Mult: m1 * m2
        • Div: m1 / m2 (Format: Float)
        • Perc m1 / m2 (Format: Percentage)
        • -
        • Custom: Special option only visible in debug mode to write a custom formula.
        • +
        • Custom: Special option only visible in debug mode to write a +custom formula.
        -
    -
  • -
  • Name: The name of the new measure (emtpy = auto-generated)
  • -
  • -
    Format: How will the value be printed
    -
      +
    • Name: The name of the new measure (emtpy = auto-generated)

      +
    • +
    • Format: How will the value be printed

      +
      • Integer
      • Float
      • Percentage (value * 100)
      -
    -
  • -
  • -
    Formula*: Custom operation formula
    -
    These formula is evaluated using ‘PY.eval’
    -
    +
  • +
    Formula*: Custom operation formula
    +
    These formula is evaluated using ‘PY.eval’
    +
-
-
-

These computed measures can be mixed (You can reuse it to make new computed measures) and saved as favorites.

-

Notice that “measures/computed measures” involved in an active ‘computed measure’ -can’t be deactivated until you have deactivate the ‘computed measure’.

+

These computed measures can be mixed (You can reuse it to make new +computed measures) and saved as favorites.

+

Notice that “measures/computed measures” involved in an active ‘computed +measure’ can’t be deactivated until you have deactivate the ‘computed +measure’.

Known issues / Roadmap

@@ -442,7 +439,7 @@ can’t be deactivated until you have deactivate the ‘computed measure’.

Bugs are tracked on GitHub 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.

+feedback.

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

@@ -468,13 +465,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

Current maintainer:

CarlosRoca13

-

This module is part of the OCA/web project on GitHub.

+

This module is part of the OCA/web project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml b/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml index a2bdc905d..5cb869960 100644 --- a/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml +++ b/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml @@ -39,10 +39,10 @@ Computed Measure - - + +
diff --git a/web_pivot_computed_measure/static/src/pivot/pivot_model.esm.js b/web_pivot_computed_measure/static/src/pivot/pivot_model.esm.js index 96d09f668..6a2f454c0 100644 --- a/web_pivot_computed_measure/static/src/pivot/pivot_model.esm.js +++ b/web_pivot_computed_measure/static/src/pivot/pivot_model.esm.js @@ -148,7 +148,7 @@ patch(PivotModel.prototype, "web_pivot_computed_measure.PivotModel", { if (subGroupData.__count === 0) { subGroupData[cm.id] = false; } else { - // eslint-disable-next-line no-undef + subGroupData[cm.id] = evalOperation(cm.operation, subGroupData); } } diff --git a/web_pivot_computed_measure/static/src/pivot/pivot_view.xml b/web_pivot_computed_measure/static/src/pivot/pivot_view.xml index b8ae60aaf..4027ce8c5 100644 --- a/web_pivot_computed_measure/static/src/pivot/pivot_view.xml +++ b/web_pivot_computed_measure/static/src/pivot/pivot_view.xml @@ -1,9 +1,9 @@ - - - - - + + + + + diff --git a/web_pivot_computed_measure/static/src/view.xml b/web_pivot_computed_measure/static/src/view.xml index 20da6cd4b..c295ffc89 100644 --- a/web_pivot_computed_measure/static/src/view.xml +++ b/web_pivot_computed_measure/static/src/view.xml @@ -1,12 +1,16 @@ - - !measure.startsWith('__computed_') - - -