mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
print_options is now in printing, new api for ir.actions.report.xml
This commit is contained in:
committed by
Graeme Gellatly
parent
a38e724c88
commit
a7aa6cbccb
@@ -97,3 +97,34 @@ class Printer(orm.Model):
|
||||
if not printer.tray_ids:
|
||||
self._update_tray_option(db_name, uid, printer, context=context)
|
||||
return res
|
||||
|
||||
def print_options(self, cr, uid, report_id, format, context=None):
|
||||
"""
|
||||
Hook to define Tray
|
||||
"""
|
||||
printing_act_obj = self.pool.get('printing.report.xml.action')
|
||||
options = super(ReportXML, self).set_print_options(cr, uid, report_id, format, context=context)
|
||||
|
||||
# Retrieve user default values
|
||||
user = self.pool.get('res.users').browse(cr, uid, context)
|
||||
tray = user.printer_tray_id
|
||||
report = self.browse(cr, uid, report_id, context=context)
|
||||
|
||||
# Retrieve report default values
|
||||
if report.printer_tray_id:
|
||||
tray = report.printer_tray_id
|
||||
|
||||
# Retrieve report-user specific values
|
||||
act_ids = printing_act_obj.search(
|
||||
cr, uid,
|
||||
[('report_id', '=', report.id),
|
||||
('user_id', '=', uid),
|
||||
('action', '!=', 'user_default')], context=context)
|
||||
if act_ids:
|
||||
user_action = printing_act_obj.browse(cr, uid, act_ids[0], context=context)
|
||||
if user_action.tray_id:
|
||||
tray = user_action.tray_id
|
||||
|
||||
if tray:
|
||||
options['InputSlot'] = str(tray.system_name)
|
||||
return options
|
||||
|
||||
Reference in New Issue
Block a user