Odoo Help


How to print automatically from action

on 11/19/14, 11:12 AM 1,218 views


I have installed the module base_report_to_printer to directly print some reports to printer.

Now, I would like to trigger the reporting when using a validate button (ex : produce invoice from sale.order). So that means I want the server to produce the report and to send it to cups.

Is there any way to do it?



Have you tried making the method to return a report action?

on 11/20/14, 1:54 AM
Ankit Gauri
On 6/17/15, 3:19 AM

hi david

try this


<button name="Method_name" string="Print Report" type="object"/>


def Method_name(self, cr, uid, ids, context=None):

    model_obj = self.pool.get("model.name")

    domain = [('assort_id', 'in', ids)]

    model_ids= model_obj.search(cr, uid, domain,context=context)

return self.pool.get('report').get_action(cr, uid, model_ids, 'report_name', context=context)

  Thank you

On 6/17/15, 3:03 AM

On button click you will call this method and in method you will put validation you want and return report after validation.

def METHOD_NAME(self, cr, uid, ids, context=None):

datas = {

'active_ids': ids,

'active_model': 'MODEL OBJECT',


return {'type': 'ir.actions.report.xml', 'report_name': 'rREPORT NAME', 'datas': datas, 'nodestroy': True}

Hope you will get your answer.

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.


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

2 follower(s)


Asked: 11/19/14, 11:12 AM
Seen: 1218 times
Last updated: 6/17/15, 3:20 AM