mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
Error on installation of the module
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user