mis-builder icon indicating copy to clipboard operation
mis-builder copied to clipboard

[16.0][IMP] mis_builder: introduce annotation in reports

Open AnizR opened this issue 8 months ago • 27 comments

This PR introduces 'annotation' in mis_builder reports. An annotation is a comment or a remark that a user can write on a cell.

It tries to solve issue: #159 (opened 6 yeas ago!)

Description

The goal is to write a remark on a cell (independently of the pivot date). These annotations are visible directly within the view but also at export in .pdf and in .xlsx.

Edit: 2 security groups have been introduced to allow edit and read of annotaitons Edit 2: It is not possible to add a note on a line that comes from the option "details by account"

Overview

UI in mis_builder_widget

On cells, we have now a drop down menu to drill down or annotate: image It opens a window to write an annotation: image image

Print .pdf

The annotation is also present in the .pdf: image

Export .xls

In the .xls, the annotation are added as 'comment' on cells: image

AnizR avatar Apr 03 '25 08:04 AnizR

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

OCA-git-bot avatar Apr 03 '25 08:04 OCA-git-bot

Long wait feature finally come.

I tried on runboat using Chrome, Edge and Safari. The drop down menu is behind the other row.

Screen Shot 2025-04-03 at 11 19 37 PM

It looks okay on Firefox, but no sequence number is added in the footnotes. If I refresh the browser the notes is gone. Screen Shot 2025-04-03 at 11 21 59 PM

Thanks

hitrosol avatar Apr 03 '25 16:04 hitrosol

Long wait feature finally come.

It was just waiting for someone to fund it.

sbidoul avatar Apr 03 '25 16:04 sbidoul

Long wait feature finally come.

I tried on runboat using Chrome, Edge and Safari. The drop down menu is behind the other row.

Screen Shot 2025-04-03 at 11 19 37 PM

It looks okay on Firefox, but no sequence number is added in the footnotes. If I refresh the browser the notes is gone. Screen Shot 2025-04-03 at 11 21 59 PM

Thanks

Thanks for your feedback. I am using firefox but I'll try to figure out why it doesn't work with other browsers. Regarding the annotations, I opened your instance and indeed, it doesn't work with your column '3 M Budget' but it works with others. I'll fix it: image

AnizR avatar Apr 03 '25 19:04 AnizR

Long wait feature finally come.

I tried on runboat using Chrome, Edge and Safari. The drop down menu is behind the other row.

Screen Shot 2025-04-03 at 11 19 37 PM

It looks okay on Firefox, but no sequence number is added in the footnotes. If I refresh the browser the notes is gone. Screen Shot 2025-04-03 at 11 21 59 PM

Thanks

It should be fixed now. Thanks for your feedback!

AnizR avatar Apr 07 '25 15:04 AnizR

It works well!

Would it be possible to make the annotations company-dependent? This would allow each company to have its own comments if the report is shared between several companies.

Thanks for your feedback!

Annotations are now linked to a company. This company is the 'main' company of the user when creating the annotation.

AnizR avatar Apr 09 '25 10:04 AnizR

Annotations are now linked to a company. This company is the 'main' company of the user when creating the annotation.

Is that not potentially surprising for the user?

For instance, what if it is a multi-company consolidation report?

sbidoul avatar Apr 09 '25 13:04 sbidoul

I wonder to what extent the annotation should be linked to (some of) the filter values of the report (effective companies, pivot date, ...).

sbidoul avatar Apr 09 '25 15:04 sbidoul

Annotations are now linked to a company. This company is the 'main' company of the user when creating the annotation.

Is that not potentially surprising for the user?

For instance, what if it is a multi-company consolidation report?

I figured that the 'final user' would always use the same 'main company' when watching his report. Therefore, in my case, it makes sense to attach annotations to the 'main company'. What would you prefer? Storing every companies selected when watching the report?

I wonder to what extent the annotation should be linked to (some of) the filter values of the report (effective companies, pivot date, ...).

I thought about adding the pivot date but realized that in odoo enterprise, they also have an 'annotation' feature but they don't store the pivot date. The annotation is linked to the 'cell'.

AnizR avatar Apr 09 '25 15:04 AnizR

I wonder to what extent the annotation should be linked to (some of) the filter values of the report (effective companies, pivot date, ...).

I changed a bit my code:

  • I removed the field 'company_id' on annotations
  • I introduced a 'annotation_context' that represents the context in which an annotation has been added and in which we should display an annotation.

For now, I only use the 'query_company_ids' from the mis report instance.

So, let's say that we have a report that can be used on company A and B. I am on company A and I add a note. This note will be visible only if I display the report from company A (without company B). If I add a note while having company A and B selected, this note will be displayed on the report only if I have company A and B selected.

AnizR avatar Apr 11 '25 08:04 AnizR

Here are a few remarks about ergonomy:

* Now the cells where there is no drill down are underlined on hover. It is important that this underline appears only as visual cue that a drilldown is possible, as before.

* After adding an annotation I had to refresh to see it. Is that intended?

* Removing an annotation leaves a weird display, with the little call out still present until I refresh

image

I think it's important that the annotation changes appear correctly immediately, and without requiring a full recompute.

Tested with chrome on the demo report on runboat.

Thanks for your feedback. I have done some changes, those ergonomic issues are fixed. Now, the loading of notes can be triggered independently from the computation of the matrix of a report!

AnizR avatar Apr 15 '25 08:04 AnizR

I have done some changes and improvements that were asked.

I've done multiple commits in order to make the review easier. Once everything will be "approved", I'll squash all my commits.

AnizR avatar Apr 16 '25 06:04 AnizR

A few more details.

If disabled menu items don't work I really prefer to have the little triangle with an empty menu so figures stay aligned. Can yo also put a little space between the cell content and the arrow?

image

Otherwise I think its almost done. Thanks a lot!

Thanks again for your review. Here is how it looks now with some padding and the drop-down button greyed out: image

AnizR avatar Apr 17 '25 08:04 AnizR

There is still an alignment problem: image

sbidoul avatar Apr 17 '25 10:04 sbidoul

Also, can we tweak the pdf a little bit?

  • In cells, make a reserved space for the footnoote callout so figures remain aligned? Add this reserved space in all cells only if there is at least one note?
  • Remove the bullets in the bottom footnotes list (in books or documents we usually see the footnote number, it's enough and nicer).
  • Add a some padding between the bottom footnotes list and the table.

image

sbidoul avatar Apr 17 '25 10:04 sbidoul

In cells, make a reserved space for the footnoote callout so figures remain aligned? Add this reserved space in all cells only if there is at least one note?

In the widget too?

sbidoul avatar Apr 17 '25 10:04 sbidoul

There is still an alignment problem: image

Finally :+1: image

AnizR avatar Apr 17 '25 13:04 AnizR

  1. The structure of the note with line breaks is not retained in footnotes.

image

image

  1. Is it possible that when we click on the footnote number, we are redirected to the footnote in the report?

SAnnabelle avatar Apr 18 '25 08:04 SAnnabelle

Rich text annotations might be a can of worms :) And it's not really a footnote anymore (if we compare to books or documents). Is that an important use case?

sbidoul avatar Apr 18 '25 09:04 sbidoul

Is it possible that when we click on the footnote number, we are redirected to the footnote in the report?

Which makes me think. In the widget is it not better to display footnotes on hover? In large reports where the footnotes be far below the view it would make them easier to view.

sbidoul avatar Apr 18 '25 09:04 sbidoul

Is it possible that when we click on the footnote number, we are redirected to the footnote in the report?

Which makes me think. In the widget is it not better to display footnotes on hover? In large reports where the footnotes be far below the view it would make them easier to view.

I'll add it on hover but it is possible to directly see the annotation by opening the wizard to edit the annotation

AnizR avatar Apr 18 '25 09:04 AnizR

It is possible to directly see the annotation by opening the wizard to edit the annotation

Except if you are a readonly user?

sbidoul avatar Apr 18 '25 09:04 sbidoul

Rich text annotations might be a can of worms :) And it's not really a footnote anymore (if we compare to books or documents). Is that an important use case?

What I can do is allowing multi line note and display as: image

It is possible to directly see the annotation by opening the wizard to edit the annotation

Except if you are a readonly user?

In deed!

AnizR avatar Apr 18 '25 09:04 AnizR

I've added:

  1. Displaying note when hovering the sequence of annotation
  2. Clicking on annotations triggers a scroll down to the section of note
  3. In the footnotes, when clicking on the number of a note, it will scroll up to the corresponding note
  4. Multi line notes are displayed in multi line instead of forcing it into one line

AnizR avatar Apr 18 '25 12:04 AnizR

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). 🤖

OCA-git-bot avatar Apr 22 '25 06:04 OCA-git-bot

The 'drill down' seems to be broken, I'll fix it.

Fixed!

AnizR avatar Apr 22 '25 06:04 AnizR

If there are no additional comments I'll merge next week.

sbidoul avatar May 08 '25 10:05 sbidoul

/ocabot merge minor

sbidoul avatar May 22 '25 13:05 sbidoul

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 16.0-ocabot-merge-pr-676-by-sbidoul-bump-minor, awaiting test results.

OCA-git-bot avatar May 22 '25 13:05 OCA-git-bot

Congratulations, your PR was merged at adc42e27e907f3e33b6df924b211022bbbcac327. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar May 22 '25 13:05 OCA-git-bot