[MIG] base_report_to_printer: Migration to 13.0

This commit is contained in:
Rod Schouteden
2019-09-30 12:13:42 +02:00
committed by Carlos Roca
parent 32352977ed
commit b1103c7b6d
20 changed files with 69 additions and 76 deletions

View File

@@ -3,7 +3,7 @@
import logging
from datetime import datetime
from odoo import models, fields, api, exceptions, _
from odoo import models, fields, exceptions, _
_logger = logging.getLogger(__name__)
@@ -32,13 +32,12 @@ class PrintingServer(models.Model):
string='Printers List',
help='List of printers available on this server.')
@api.multi
def _open_connection(self, raise_on_error=False):
self.ensure_one()
connection = False
try:
connection = cups.Connection(host=self.address, port=self.port)
except:
except Exception:
message = _("Failed to connect to the CUPS server on %s:%s. "
"Check that the CUPS server is running and that "
"you can reach it from the Odoo server.") % (
@@ -49,11 +48,9 @@ class PrintingServer(models.Model):
return connection
@api.multi
def action_update_printers(self):
return self.update_printers()
@api.multi
def update_printers(self, domain=None, raise_on_error=False):
if domain is None:
domain = []
@@ -106,7 +103,6 @@ class PrintingServer(models.Model):
self = self.search([])
return self.update_jobs()
@api.multi
def update_jobs(self, which='all', first_job_id=-1):
job_obj = self.env['printing.job']
printer_obj = self.env['printing.printer']