[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
committed by trisdoan
parent 92723f3b7c
commit b719f7e3ea
9 changed files with 75 additions and 20 deletions

View File

@@ -12,7 +12,7 @@ import logging
import os
from tempfile import mkstemp
from odoo import fields, models
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
@@ -67,6 +67,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"}