mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[IMP] Allow to define a default printer for the printing wizard
This commit is contained in:
committed by
Lois Rilo
parent
a2d632337c
commit
2b02938cd8
@@ -39,6 +39,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
|
||||
active_model='printing.printer',
|
||||
active_id=self.printer.id,
|
||||
active_ids=[self.printer.id],
|
||||
printer_zpl2_id=self.printer.id,
|
||||
)
|
||||
wizard = wizard_obj.create({})
|
||||
self.assertEqual(wizard.printer_id, self.printer)
|
||||
@@ -87,6 +88,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
|
||||
active_model='printing.printer',
|
||||
active_id=self.printer.id,
|
||||
active_ids=[self.printer.id],
|
||||
printer_zpl2_id=self.printer.id,
|
||||
)
|
||||
wizard = wizard_obj.create({})
|
||||
self.assertEqual(wizard.label_id, self.label)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user