From 33aeaa45b3055ac094d24d3fd191272142c0b496 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 27 Jan 2025 16:55:55 +0100 Subject: [PATCH 01/14] [IMP] spreadsheet_oca: Add company_id on spreadsheet.spreadsheet model and related classic ir.rules --- spreadsheet_oca/models/spreadsheet_spreadsheet.py | 6 ++++++ spreadsheet_oca/security/security.xml | 6 ++++++ spreadsheet_oca/views/spreadsheet_spreadsheet.xml | 2 ++ 3 files changed, 14 insertions(+) diff --git a/spreadsheet_oca/models/spreadsheet_spreadsheet.py b/spreadsheet_oca/models/spreadsheet_spreadsheet.py index 5c56917e..657477f2 100644 --- a/spreadsheet_oca/models/spreadsheet_spreadsheet.py +++ b/spreadsheet_oca/models/spreadsheet_spreadsheet.py @@ -37,6 +37,12 @@ class SpreadsheetSpreadsheet(models.Model): string="Readers", ) + company_id = fields.Many2one( + comodel_name="res.company", + help="If set, the spreadsheet will be available only" + " if this company is in the current companies.", + ) + @api.depends("name") def _compute_filename(self): for record in self: diff --git a/spreadsheet_oca/security/security.xml b/spreadsheet_oca/security/security.xml index 6b7998af..ea1459d7 100644 --- a/spreadsheet_oca/security/security.xml +++ b/spreadsheet_oca/security/security.xml @@ -20,6 +20,12 @@ eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]" /> + + + Spreadsheet Company Rule + + [('company_id', 'in', company_ids + [False])] + Spreadsheet Owner diff --git a/spreadsheet_oca/views/spreadsheet_spreadsheet.xml b/spreadsheet_oca/views/spreadsheet_spreadsheet.xml index 7d289c3e..f7f72b05 100644 --- a/spreadsheet_oca/views/spreadsheet_spreadsheet.xml +++ b/spreadsheet_oca/views/spreadsheet_spreadsheet.xml @@ -19,6 +19,7 @@ +