-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
[12.0][ADD] report_async #355
Conversation
@Saran440 can you review this? |
a27af7f
to
52d014c
Compare
This module is ready for review / merge Note: --test-enable can result in fallback to type html (it is in Odoo core). So, when you test by hand, make sure you don't use --test-enable on your environment. |
Very interesting. Regarding the mechanism to make the file available to the user, I have a preference for the one in base_export_async which sends an email with a link to the report that only the user can download. It also has a mechanism to remove these files after a while. |
@sbidoul we have both, do you think it is ok? In fact, base_export_async was my example for this. |
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.
Code review. Apart of that, this is great !
report_async/__manifest__.py
Outdated
'version': '12.0.1.0.0', | ||
'author': 'Ecosoft, Odoo Community Association (OCA)', | ||
'license': 'AGPL-3', | ||
'website': 'https://github.com/OCA/queue', |
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.
'website': 'https://github.com/OCA/queue', | |
'website': 'https://github.com/OCA/reporting-engine', |
|
||
@api.multi | ||
def _compute_job(self): | ||
for rec in self: |
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.
for rec in self: | |
for rec in self.sudo(): |
At each call of sudo(), a new environment is created and can lead to performance issues.
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.
Or should I remove all the .sudo() from _compute_job()
and use compute_sudo=True
in all fields that call _compute_job instead?
WDYT?
report_async/models/report_async.py
Outdated
@api.multi | ||
def _compute_file(self): | ||
for rec in self: | ||
rec.file_ids = self.env['ir.attachment'].search( |
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.
Move the search before the loop with ('res_id', 'in', self.ids) and then filter.
It can avoid many sql queries.
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.
Great idea. Fixed.
report_async/models/report_async.py
Outdated
'recipient_ids': [(6, 0, [user.partner_id.id])], | ||
'subject': _("Export {} {}").format( | ||
description, fields.Date.to_string(fields.Date.today())), | ||
'body_html': _(""" |
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.
Mmmmh, maybe a mail.template ?
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.
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.
Add a widget in the navigation drawer to centrally notify the report print results.
How about this suggestion?
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.
This is great anyway
@OCA/core-maintainers |
493060d
to
afdfc2b
Compare
afdfc2b
to
035b373
Compare
035b373
to
952754c
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.
Tested locally and LGTM!
Just two questions. Is the dashboards app the best place for the report center? And should we create a security group to better control who accesses this?
Thank you for this awesome module!
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 for the effort!!! I think this is really a good implementation!!!
About the widget on the bar, that could be a great idea, but we can do this on a new PR, this way we can proceed. On the other hand, I agree about the need of a group.
About groups, the first idea is allow everyone to create his/her own report async. And have someone (group_no_one) to see them all. WDYT? |
Good for me. |
@kittiu Okay, I agree with you, we can merge this and discuss it later. |
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at 860ea84. Thanks a lot for contributing to OCA. ❤️ |
The new menu "Report Center" is the central place to host all your reports in one place.
From here, there are 2 ways to launch the report,