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
committed by Sylvain GARANCHER
parent 254495f994
commit b4e9161dcc

View File

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