[IMP] Allow to define a default printer for the printing wizard

This commit is contained in:
Florent de Labarre
2018-01-23 00:56:50 +01:00
parent 1025f6548b
commit 96c21e9870
2 changed files with 6 additions and 1 deletions

View File

@@ -23,7 +23,10 @@ class PrintRecordLabel(models.TransientModel):
values = super(PrintRecordLabel, self).default_get(fields_list)
# Automatically select the printer and label, if only one is available
printers = self.env['printing.printer'].search([])
printers = self.env['printing.printer'].search(
[('id', '=', self.env.context.get('printer_zpl2_id'))])
if not printers:
printers = self.env['printing.printer'].search([])
if len(printers) == 1:
values['printer_id'] = printers.id