[FIX] base: don't assume res_ids is a list

https://github.com/odoo/odoo/pull/85150 introduced the method
_render_qweb_pdf_prepare_streams called from _render_qweb_pdf
giving it its res_ids.
Two places in this method are assuming res_ids will be a list, but
it is not always the case. Plenty of call to _render_qweb_pdf is
giving it a single id as a parameter.

This will ensure that res_ids is a list by creating one for single ids
too before proceeding with the logic of the pdf rendering.

closes odoo/odoo#91631

Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
Nicolas (vin)
2022-05-18 13:08:26 +02:00
parent 52d6089e1a
commit e8f8b93bd1
@@ -764,6 +764,8 @@ class IrActionsReport(models.Model):
self.ensure_one()
if not data:
data = {}
if isinstance(res_ids, int):
res_ids = [res_ids]
data.setdefault('report_type', 'pdf')
self_sudo = self.sudo()