Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

Hi,
I'm trying to pass both docids and data to the qweb report but realise that I can only pass docids or data. In my search for this issue, I found exactly the same issue as my problem but closed.

Error when using data parameter in report_action function 

@pedrobaeza said:

I would say that using both arguments (docids and data) is not something supported. 

Why not? And how can I do this in another way?

Thanks!

Awatar
Odrzuć
Autor

Hi everyone, any solutions?

Najlepsza odpowiedź

Hi

Try the following code,

from odoo import models,api
class VehicleReport(models.AbstractModel):
    _name = 'report.vehicle.report_vehicle_order’
 
    @api.model
    def _get_report_values(self, docids, data=None):
        docs = self.env[model.model].browse(docids)
        return {
              'doc_ids': docids,
              'doc_model': model.model,
              'docs': docs,
              'data': data,
        }


For more reference, you can refer to the blog : https://www.cybrosys.com/blog/how-to-create-a-custom-pdf-report-in-odoo-16

Hope it helps

Awatar
Odrzuć
Autor

Hi,
Thank you for your answer, but it's not working.

Powiązane posty Odpowiedzi Widoki Czynność
3
sie 25
2607
1
maj 25
2638
1
kwi 25
3626
1
kwi 25
4490
1
kwi 25
1960