[18.0] [FIX] report_pdf_form: handle also report id as report_ref#1175
Conversation
|
Hi @grindtildeath, |
df7300d to
8b90db2
Compare
8b90db2 to
a8e652c
Compare
| elif isinstance(report_ref, str): | ||
| pdf_form_report = ReportPdfForm.search([("report_name", "=", report_ref)]) |
There was a problem hiding this comment.
question: Could it be an xmlid ?
There was a problem hiding this comment.
I would say so, yes. Would that be a problem?
| [("report_name", "=", report_ref)] | ||
| ) | ||
| ReportPdfForm = self.env["report.pdf.form"] | ||
| if isinstance(report_ref, int): |
There was a problem hiding this comment.
There is a _get_report function to do this maybe https://github.com/odoo/odoo/blob/18.0/odoo/addons/base/models/ir_actions_report.py#L649
There was a problem hiding this comment.
Thank you for the review. Yes, I have just noticed that method as well. It is in fact used by the original _render_qweb_pdf_prepare_streams so I think I only need if isinstance(report_ref, str) before the original search. I will verify that and update a PR.
There was a problem hiding this comment.
I refactored based on the suggestion. Can you please check @TDu @mmequignon?
a8e652c to
7064e93
Compare
|
/ocabot merge patch |
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
Congratulations, your PR was merged at 52e03a5. Thanks a lot for contributing to OCA. ❤️ |
_render_qweb_pdf_prepare_streamscan receivereport_refas an int, a models.Model instance, or a str. We then can get an error like below. I suggest to cover all three cases.