[IMP] base_report_to_printer: Add printer option to launch reports in new thread

This commit is contained in:
sergio-teruel
2024-10-26 23:32:27 +02:00
parent 8a02cdf523
commit ef9de46896
11 changed files with 87 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ import logging
import os
from tempfile import mkstemp
from odoo import fields, models
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
@@ -66,6 +66,14 @@ class PrintingPrinter(models.Model):
tray_ids = fields.One2many(
comodel_name="printing.tray", inverse_name="printer_id", string="Paper Sources"
)
multi_thread = fields.Boolean(
compute="_compute_multi_thread", readonly=False, store=True
)
@api.depends("server_id.multi_thread")
def _compute_multi_thread(self):
for printer in self:
printer.multi_thread = printer.server_id.multi_thread
def _prepare_update_from_cups(self, cups_connection, cups_printer):
mapping = {3: "available", 4: "printing", 5: "error"}