-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
[16.0][IMP] mis_builder: introduce annotation in reports #676
base: 16.0
Are you sure you want to change the base?
Conversation
Hi @sbidoul, |
e1171ed
to
17e5985
Compare
It was just waiting for someone to fund it. |
17e5985
to
63ac433
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AnizR. Here is a first round of comment after a quick look.
63ac433
to
267c047
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
267c047
to
9b9bb7b
Compare
Thanks for your feedback! Annotations are now linked to a company. |
Is that not potentially surprising for the user? For instance, what if it is a multi-company consolidation 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 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 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'. |
9b9bb7b
to
6c0cd21
Compare
I changed a bit my code:
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. |
"kpi_id": kpi_id, | ||
"subkpi_id": subkpi_id, | ||
"note": note, | ||
"annotation_context": self._get_annotation_context(instance_id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"annotation_context": self._get_annotation_context(instance_id), | |
"annotation_context": json.dumps(instance_id._get_annotation_context()), |
It's simpler.
But is the json.dumps
necessary? I'd think we can provide the dict to the json field.
""" | ||
Return context of annotation linked to this instance | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | |
Return context of annotation linked to this instance | |
""" | |
"""Return the context used to filter annotation linked to this instance.""" |
Also, nit: https://peps.python.org/pep-0257/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
I think it's important that the annotation changes appear correctly immediately, and without requiring a full recompute.
Tested with firefox on the demo report on runboat.
eval="[Command.link(ref('mis_builder.group_read_annotation'))]" | ||
/> | ||
</record> | ||
</odoo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatically assign these new groups to the admin user? I think there is a pattern for that throughout Odoo.
t-if="cell.drilldown_arg" | ||
role="menuitem" | ||
> | ||
Explore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drill down instead of Explore ? not sure.
But can we keep the immediate drill down when we click on the value, and have the menu appear only when we click on the little down arrow ?
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record model="res.groups" id="group_read_annotation"> | ||
<field name="name">Mis report: read annotation</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<field name="name">Mis report: read annotation</field> | |
<field name="name">MIS Report: view annotations</field> |
<field name="name">Mis report: read annotation</field> | ||
</record> | ||
<record model="res.groups" id="group_edit_annotation"> | ||
<field name="name">Mis report: edit annotation</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<field name="name">Mis report: edit annotation</field> | |
<field name="name">MIS report: add annotations</field> |
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
Overview
UI in mis_builder_widget
On cells, we have now a drop down menu to drill down or annotate:



It opens a window to write an annotation:
Before refreshing, annotations are pushed to the db, added in the 'footnotes' and if we try to 're-annotate', the annotation is displayed but the sequence is not yet set.
After refreshing, annotations are numbered. I did this to avoid the user to force to refresh his report each time he writes an annotation.
Print .pdf
The annotation is also present in the .pdf:

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