Error on installation of the module

This commit is contained in:
Guewen Baconnier
2014-11-18 10:09:13 +01:00
parent caa9edb4e8
commit 2cc8ae8162

View File

@@ -59,6 +59,11 @@ class PrintingPrinterPolling(models.Model):
polling = self.search([], limit=1)
return polling
@api.model
@ormcache()
def table_exists(self):
return self._model._table_exist(self.env.cr)
@api.model
def find_or_create_unique_record(self):
polling = self.find_unique_record()
@@ -300,6 +305,11 @@ class PrintingPrinter(models.Model):
def update(self):
"""Update printer status if current status is more than 10s old."""
polling_obj = self.env['printing.printer.polling']
if not polling_obj.table_exists():
# On the installation of the module, this method could be
# called before the 'printing.printer.polling' table exists
# (but the model already is in memory)
return
if polling_obj.need_update():
self.start_printer_update()
return True