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

[14.0]Download report is not possible because of private _render method #65

Open
flotho opened this issue Oct 18, 2021 · 7 comments
Open
Labels
Milestone

Comments

@flotho
Copy link
Member

flotho commented Oct 18, 2021

In v14, Odoo turn the public render method as private : OCA/OCB@d9287ca#diff-7ce69a093ea1fb1cf2989e24d52cb8e717ab4f2b3c2006ba5cc67503a3df1aff
gives this new signature : https://github.com/OCA/OCB/blob/14.0/odoo/addons/base/models/ir_actions_report.py#L871

Trying to download a report throws this issue :

   report = odoo.report.download('stock.report_deliveryslip', [2, ])
  File "/home/florent.thomas/.local/lib/python3.8/site-packages/odoorpc/report.py", line 118, in download
    response = report.with_context(context)._render(
  File "/home/florent.thomas/.local/lib/python3.8/site-packages/odoorpc/models.py", line 389, in __getattr__
    return super(Model, self).__getattr__(method)
AttributeError: 'super' object has no attribute '__getattr__'

@MiquelRForgeFlow , how do you succeed to make this work : 187853a#diff-891d7fc45dba1b16d043072a3d345c82fdecfd4e466ee9d90c0288c32dfc2ccfR118
Is there any workaround from your point of view ?

@flotho
Copy link
Member Author

flotho commented Oct 18, 2021

odoo/odoo#78528

@MiquelRForgeFlow
Copy link
Contributor

how do you succeed to make this work

I didn't. See #60 (comment), when @sebalix said:

Regarding the issue for v14 _render, we could try to use the HTTP controller to generate the report if possible.

@flotho
Copy link
Member Author

flotho commented Oct 18, 2021

do you mean the idea is to generate a crsf token and then call a report url ?

@tejastank
Copy link

tejastank commented May 27, 2022

#odoo 14

def render(self, res_ids, data=None):
    print("asdfadsf")
    report_type = self.report_type.lower().replace('-', '_')
    render_func = getattr(self, '_render_' + report_type, None)
    if not render_func:
        return None
    return render_func(res_ids, data=data)

we added in odoo branch code, ir_actions_report.py, next to _render, we added this code and its resolve for us, until official team resolve

Hope this will helps someone have urgency

regards,
tejas
Xamta Infotech - xamta.in
snippetbucket.com (Previous Trade Name)

  • additional, in odoorpc lib, inside report.py, need to rename _render to render

@sebalix sebalix added this to the v0.10.0 milestone Sep 30, 2022
@sebalix
Copy link
Collaborator

sebalix commented Sep 30, 2022

Yes this still need to be addressed, I wanted to grab the CSRF token from the login web page for instance and use it for methods that required one starting from Odoo 14.0.
Will try to implement this for release v0.10.0.

@sebalix sebalix added the bug label Sep 30, 2022
@AnaelMobilia
Copy link

@sebalix Have you found any idea on how to grab the CSRF token for this issue ?

Bests regards,
Anael

@flotho
Copy link
Member Author

flotho commented Feb 9, 2024

for the record : #88 (comment)

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

No branches or pull requests

5 participants