If we do not have yet such a print scenario that you need, then for your developers it is rather simple to do by following steps below. We made our module to be very easy to adapt to your customizations.
In place inside your module where you want to print a document do the following:
First insert below code to get current users printer and printer tray bin. It is needed to proceed with the printing. If the user has no printer defined – then there is not possible to print:
user = self.env.user printer_id, printer_bin = user.get_report_printer(report.id)
report – object of type ir.actions.report. Corresponds to the printed report you are going to print
After this just call printing like below. And you are all set!
options = {'bin': printer_bin} if printer_bin else {} printer_id.printnode_print( report, objects, copies=1, options=options, )
objects – is a list of any objects (browse records) for which you want to print a specified report. For example, a list of invoices / sales orders etc
report – object of type ir.actions.report. Corresponds to the printed report you are going to print
copies – this parameter allows you to specify number of copies to print