From b2b7918e9ddc2d16f7b150e93d594a07b7617bd3 Mon Sep 17 00:00:00 2001 From: sergio-teruel Date: Mon, 30 Sep 2024 22:53:22 +0200 Subject: [PATCH] [IMP] sale_order_product_assortment: Add security group to only show assortments to managers TT51064 --- sale_order_product_assortment/__manifest__.py | 7 +++++-- .../migrations/15.0.3.0.0/noupdate_changes.xml | 9 +++++++++ .../migrations/15.0.3.0.0/post-migration.py | 10 ++++++++++ sale_order_product_assortment/models/sale_order.py | 1 + .../sale_order_product_assortment_security.xml | 9 +++++++++ .../static/description/index.html | 1 - 6 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 sale_order_product_assortment/migrations/15.0.3.0.0/noupdate_changes.xml create mode 100644 sale_order_product_assortment/migrations/15.0.3.0.0/post-migration.py create mode 100644 sale_order_product_assortment/security/sale_order_product_assortment_security.xml diff --git a/sale_order_product_assortment/__manifest__.py b/sale_order_product_assortment/__manifest__.py index 9f63e38770e..75bdb379179 100644 --- a/sale_order_product_assortment/__manifest__.py +++ b/sale_order_product_assortment/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Order Product Assortment", "summary": "Module that allows to use the assortments on sale orders", - "version": "15.0.2.0.0", + "version": "15.0.3.0.0", "development_status": "Beta", "category": "Sales", "website": "https://github.com/OCA/sale-workflow", @@ -13,5 +13,8 @@ "license": "AGPL-3", "installable": True, "depends": ["sale", "product_assortment", "base_view_inheritance_extension"], - "data": ["views/sale_order_view.xml"], + "data": [ + "security/sale_order_product_assortment_security.xml", + "views/sale_order_view.xml", + ], } diff --git a/sale_order_product_assortment/migrations/15.0.3.0.0/noupdate_changes.xml b/sale_order_product_assortment/migrations/15.0.3.0.0/noupdate_changes.xml new file mode 100644 index 00000000000..401ce8b1289 --- /dev/null +++ b/sale_order_product_assortment/migrations/15.0.3.0.0/noupdate_changes.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/sale_order_product_assortment/migrations/15.0.3.0.0/post-migration.py b/sale_order_product_assortment/migrations/15.0.3.0.0/post-migration.py new file mode 100644 index 00000000000..30f33cfa42c --- /dev/null +++ b/sale_order_product_assortment/migrations/15.0.3.0.0/post-migration.py @@ -0,0 +1,10 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data( + env.cr, + "sale_order_product_assortment", + "migrations/15.0.3.0.0/noupdate_changes.xml", + ) diff --git a/sale_order_product_assortment/models/sale_order.py b/sale_order_product_assortment/models/sale_order.py index 054caaf309c..212db671cd4 100644 --- a/sale_order_product_assortment/models/sale_order.py +++ b/sale_order_product_assortment/models/sale_order.py @@ -12,6 +12,7 @@ class SaleOrder(models.Model): comodel_name="product.product", string="Allowed Products", compute="_compute_product_assortment_ids", + compute_sudo=True, ) has_allowed_products = fields.Boolean(compute="_compute_product_assortment_ids") diff --git a/sale_order_product_assortment/security/sale_order_product_assortment_security.xml b/sale_order_product_assortment/security/sale_order_product_assortment_security.xml new file mode 100644 index 00000000000..00be767005b --- /dev/null +++ b/sale_order_product_assortment/security/sale_order_product_assortment_security.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/sale_order_product_assortment/static/description/index.html b/sale_order_product_assortment/static/description/index.html index dad774bbbfd..c673d15a3ba 100644 --- a/sale_order_product_assortment/static/description/index.html +++ b/sale_order_product_assortment/static/description/index.html @@ -1,4 +1,3 @@ -