Odoo Help

0

Odoo 11 Print two reports with one button

By
Oscar Gonzalez
on 5/9/18, 12:59 PM 386 views

I want to print two reports from one python method, i've tried all the codes that i found but, isn't working, actually a have this:

@api.multi

def print_custom_documents(self):

    first_report = self.env.ref('custom_module.billing_report_sample').report_action(self)

    second_report = self.env.ref('custom_module.invoice_report_sample').report_action(self)

    return first_report, second_report


The method is called in the form view with a button.

Also i've tried to create three methods, one to print the first report, one for the second, and the thirth to call the first and the second.

have you tried this?

return self.env.ref('custom_module.billing_report_sample').report_action(self), self.env.ref('custom_module.invoice_report_sample').report_action(self)

instead of setting up 2 variables and calling them in the return method? i know it sounds weird because it might be the same thing, but who knows if its a python thing.

also make sure that "invoice_report_sample" is the id="invoice_report_sample" in your xml code

hope I helped you, thanks.

Maquinados Industriales de Guadalajara S.A. de C.V., Daniel Medina
on 5/9/18, 6:48 PM
0
Jitu patel
On 7/9/18, 2:52 AM

Hello @Oscar Gonzalez,

Have you got any solution? I am also stuck at this point.

 

Hi, no I've not, i was reading, you only can return one dict, it have happened with other methods also.

Soluciones 4G, Oscar Gonzalez
on 7/9/18, 10:46 AM

Which other method we can get solution?

Jitu patel
on 7/10/18, 12:52 AM
0
Gustavo Hinojosa
On 5/14/18, 10:28 AM

Hello, you have to send the objects and their ids of the objects.


Example:

invoice_obj = self.env ['account.invoice'].browse([1,2])

then invoice_obj = account.invoice(1,2)

or twice the same object

invoice_obj = self.env ['account.invoice'].browse([1,1])

then invoice_obj = account.invoice(1,1)

return self.env.ref('account.account_invoices').report_action(invoice_obj)

i think this could work, but i need to print two diferent reports with the same record, not one report twice

Soluciones 4G, Oscar Gonzalez
on 5/14/18, 10:37 AM

This scheme can print N reports, of an object type.

Gustavo Hinojosa
on 5/14/18, 10:56 AM
0
Oscar Gonzalez
On 5/9/18, 6:59 PM

Yes, i've tried, and also doesn't work.

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

Question tools

1 follower(s)

Stats

Asked: 5/9/18, 12:59 PM
Seen: 386 times
Last updated: 7/9/18, 2:52 AM