From 32bffc34bf4ded5c865be845d5e7ae75241f7d02 Mon Sep 17 00:00:00 2001 From: GabbasovDinar Date: Wed, 9 Oct 2024 17:24:09 +0500 Subject: [PATCH] [16.0][IMP] base_report_to_printer: Add company rules for printers and servers --- base_report_to_printer/__manifest__.py | 2 +- .../models/printing_server.py | 3 +++ base_report_to_printer/security/security.xml | 21 +++++++++++++++++++ .../views/printing_server.xml | 13 ++++++++++-- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/base_report_to_printer/__manifest__.py b/base_report_to_printer/__manifest__.py index f0ce582b56f..9b7b32a2e09 100644 --- a/base_report_to_printer/__manifest__.py +++ b/base_report_to_printer/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Report to printer", - "version": "16.0.1.2.0", + "version": "16.0.1.2.1", "category": "Generic Modules/Base", "author": "Agile Business Group & Domsense, Pegueroles SCP, NaN," " LasLabs, Camptocamp, Odoo Community Association (OCA)," diff --git a/base_report_to_printer/models/printing_server.py b/base_report_to_printer/models/printing_server.py index 013587089e6..fcef7740d27 100644 --- a/base_report_to_printer/models/printing_server.py +++ b/base_report_to_printer/models/printing_server.py @@ -43,6 +43,9 @@ class PrintingServer(models.Model): help="List of printers available on this server.", ) multi_thread = fields.Boolean() + company_ids = fields.Many2many( + comodel_name="res.company", + ) def _open_connection(self, raise_on_error=False): self.ensure_one() diff --git a/base_report_to_printer/security/security.xml b/base_report_to_printer/security/security.xml index e0c9e2271f7..a6c34b1696c 100644 --- a/base_report_to_printer/security/security.xml +++ b/base_report_to_printer/security/security.xml @@ -148,4 +148,25 @@ + + Printing Server multi-company + + + ["|", ("company_ids", "=", False), ("company_ids", "in", company_ids)] + + + + Printer multi-company + + + ["|", ("server_id.company_ids", "=", False), ("server_id.company_ids", "in", company_ids)] + + + + Printing Job multi-company + + + ["|", ("server_id.company_ids", "=", False), ("server_id.company_ids", "in", company_ids)] + + diff --git a/base_report_to_printer/views/printing_server.xml b/base_report_to_printer/views/printing_server.xml index c43d682dff4..a153ff2329b 100644 --- a/base_report_to_printer/views/printing_server.xml +++ b/base_report_to_printer/views/printing_server.xml @@ -24,8 +24,17 @@ - - + + + + + + +