mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[FIX] use server_error variable to update printer status
This commit is contained in:
@@ -77,7 +77,6 @@ class Printer(orm.Model):
|
|||||||
db, pool = pooler.get_db_and_pool(db_name)
|
db, pool = pooler.get_db_and_pool(db_name)
|
||||||
cr = db.cursor()
|
cr = db.cursor()
|
||||||
res = super(Printer, self).update_printers_status(db_name, uid, context=context)
|
res = super(Printer, self).update_printers_status(db_name, uid, context=context)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = cups.Connection()
|
connection = cups.Connection()
|
||||||
printers = connection.getPrinters()
|
printers = connection.getPrinters()
|
||||||
@@ -86,6 +85,11 @@ class Printer(orm.Model):
|
|||||||
server_error = True
|
server_error = True
|
||||||
|
|
||||||
printer_ids = self.search(cr, uid, [('system_name', 'in', printers.keys())], context=context)
|
printer_ids = self.search(cr, uid, [('system_name', 'in', printers.keys())], context=context)
|
||||||
|
if server_error:
|
||||||
|
vals = {'status': 'server_error'}
|
||||||
|
self.write(cr, uid, printer_ids, vals, context=context)
|
||||||
|
return res
|
||||||
|
|
||||||
printer_list = self.browse(cr, uid, printer_ids, context=context)
|
printer_list = self.browse(cr, uid, printer_ids, context=context)
|
||||||
|
|
||||||
for printer in printer_list:
|
for printer in printer_list:
|
||||||
|
|||||||
Reference in New Issue
Block a user