Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP][16.0] mis_builder: allow definition of style expression on subkpi level #623

Draft
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

AnizR
Copy link
Contributor

@AnizR AnizR commented Aug 26, 2024

Description

Solves issue: #614

The goal is to be able to define a style on a cell. Therefore, this PR allows to define a style on a subkpi:
image
On my row, I will have my cell with KPI_1 in red and my cell with KPI_2 without any style.

Remark

There are now 3 ways to define a style:

  1. Style on a KPI
  2. Style expression on a KPI
  3. Style expression in expressions of a KPI

The sytle defined in [3] has priority over [2] which has priority over [1].

@OCA-git-bot
Copy link
Contributor

Hi @sbidoul,
some modules you are maintaining are being modified, check this out!

@AnizR AnizR changed the title [IMP] mis_builder: allow definition of style expression on subkpi level [IMP][16.0] mis_builder: allow definition of style expression on subkpi level Aug 28, 2024
@AnizR
Copy link
Contributor Author

AnizR commented Aug 28, 2024

I've add a small fix: when a style expression was defined, it was only used to set style of cell but not style of number (it was ignoring rounding,prefix, etc.)

Copy link

@SAnnabelle SAnnabelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally, it's correct.

image

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a style on the mis.report.kpi, for completeness and symmetry with the styling of the kpi?

mis_builder/models/kpimatrix.py Show resolved Hide resolved
@sbidoul
Copy link
Member

sbidoul commented Oct 6, 2024

Can you also add a style on the mis.report.kpi, for completeness and symmetry with the styling of the kpi?

Or, before doing that can you explain why you chose to do a style expression instead of a style m2o. The latter seems easier to use.

@AnizR
Copy link
Contributor Author

AnizR commented Oct 16, 2024

Can you also add a style on the mis.report.kpi, for completeness and symmetry with the styling of the kpi?

I suppose that you meant mis.report.kpi.expression

Or, before doing that can you explain why you chose to do a style expression instead of a style m2o. The latter seems easier to use.

The style seems 'easier' to use but in my case, it wasn't enough: I want to be able to change my style depending on multiple conditions.

Nonetheless, I'll add it for completeness

@sbidoul
Copy link
Member

sbidoul commented Oct 16, 2024

Can you also add a style on the mis.report.kpi, for completeness and symmetry with the styling of the kpi?

I suppose that you meant mis.report.kpi.expression

Yes. A style on mis.report.kpi might be useful, but it's another story.

@AnizR
Copy link
Contributor Author

AnizR commented Oct 16, 2024

Can you also add a style on the mis.report.kpi, for completeness and symmetry with the styling of the kpi?

I suppose that you meant mis.report.kpi.expression

Yes. A style on mis.report.kpi might be useful, but it's another story.

It is already implemented on mis.report.kpi:

style_id = fields.Many2one(

But indeed, adding it on mis.report.kpi.expression is complex

The main issue is the way it is injected: the style is set at the row level and not the cell level!

@sbidoul sbidoul marked this pull request as draft November 10, 2024 16:39
@sbidoul
Copy link
Member

sbidoul commented Nov 10, 2024

I'm setting this as draft, as I think a more profound refactoring is needed to do this correctly. See #647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants