Do not write the printer status if it has not changed

Avoid unnecessary UPDATE every minute
This commit is contained in:
Guewen Baconnier
2014-11-20 08:47:10 +01:00
parent 2a2caedd17
commit 2b5af7e49e

View File

@@ -101,7 +101,9 @@ class PrintingPrinter(models.Model):
:param cups_printer: dict of information returned by CUPS for the :param cups_printer: dict of information returned by CUPS for the
current printer current printer
""" """
self.ensure_one()
vals = self._prepare_update_from_cups(cups_connection, cups_printer) vals = self._prepare_update_from_cups(cups_connection, cups_printer)
if any(self[name] != value for name, value in vals.iteritems()):
self.write(vals) self.write(vals)
@api.multi @api.multi