Odoo Ajuda

0

1
7 Respostas
0
Samo Arko Eslovênia
25/05/18 09:43

I finally figured it out with the get_pdf() method. 

def save_reports_file(self):
        report_ids = self.env['hr.myreport.datas'].search([('report_id', '=', self.id)]).ids
        report_name = "module.report_name"
        pdf = self.env['report'].sudo().get_pdf(report_ids, report_name)
        self.reports_file = base64.encodestring(pdf)

 

0
Fatih Piristine Finlândia
15/05/18 05:14

invoice tree view has print invoices function. check how it is done, it might give you the idea.

see NIyas's answer here: https://www.odoo.com/forum/help-1/question/mass-downloading-invoices-126451

5 Comentários
Tabla d.o.o., Samo Arko Eslovênia
15/05/18 05:39

I need it to work from a custom button in a view. At least tell me the name of the module so I can view the source files. The answer in the link isn't helpful! I need a code example not how a end user can do it.

Fatih Piristine Finlândia
15/05/18 05:44

i thought you would notice it from attached picture. it is in accounting / customer invoices. and there is no other ready code I know of. you can do it and share it.

Tabla d.o.o., Samo Arko Eslovênia
15/05/18 05:52

the picture is a bit small so I didn't really see the menu items good. But now I have to figure out what addon modul has this code.

Niyas Raphy Índia
15/05/18 06:08

Hi,

just pass the required id's of the records in docids

Tabla d.o.o., Samo Arko Eslovênia
15/05/18 09:10

tried that before posting question because in the template is <t t-foreach="docs" t-as="o">, but it didn't work. Or I just don't know how to do it right.

Faça uma Pergunta
Writer
Marcadores
Keep Informed
1 seguidor (es)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now