From dbd3d9035b01cc618cb49b4c17fbccaf1748862e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Wed, 6 Nov 2024 10:58:11 +0100 Subject: [PATCH] [IMP+FIX] intrastat_product: Improve company rules Changes done: - Improve performance using [('company_id', 'in', company_ids + [False])] - Change intrastat.product.declaration rule because company_id field is required. - Add rules for intrastat.product.declaration.line and intrastat.product.computation.line --- intrastat_product/__manifest__.py | 2 +- .../migrations/17.0.1.1.0/noupdate_changes.xml | 12 ++++++++++++ .../migrations/17.0.1.1.0/post-migration.py | 10 ++++++++++ .../security/intrastat_security.xml | 18 +++++++++++++++--- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 intrastat_product/migrations/17.0.1.1.0/noupdate_changes.xml create mode 100644 intrastat_product/migrations/17.0.1.1.0/post-migration.py diff --git a/intrastat_product/__manifest__.py b/intrastat_product/__manifest__.py index 6b2c97f01..a94c52a9f 100644 --- a/intrastat_product/__manifest__.py +++ b/intrastat_product/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Intrastat Product", - "version": "17.0.1.0.1", + "version": "17.0.1.1.0", "category": "Intrastat", "license": "AGPL-3", "summary": "Base module for Intrastat Product", diff --git a/intrastat_product/migrations/17.0.1.1.0/noupdate_changes.xml b/intrastat_product/migrations/17.0.1.1.0/noupdate_changes.xml new file mode 100644 index 000000000..d26b8df2c --- /dev/null +++ b/intrastat_product/migrations/17.0.1.1.0/noupdate_changes.xml @@ -0,0 +1,12 @@ + + + + [('company_id', 'in', company_ids + [False])] + + + [('company_id', 'in', company_ids + [False])] + + + [('company_id', 'in', company_ids)] + + diff --git a/intrastat_product/migrations/17.0.1.1.0/post-migration.py b/intrastat_product/migrations/17.0.1.1.0/post-migration.py new file mode 100644 index 000000000..a4a274b86 --- /dev/null +++ b/intrastat_product/migrations/17.0.1.1.0/post-migration.py @@ -0,0 +1,10 @@ +# Copyright 2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data( + env.cr, "intrastat_product", "migrations/17.0.1.1.0/noupdate_changes.xml" + ) diff --git a/intrastat_product/security/intrastat_security.xml b/intrastat_product/security/intrastat_security.xml index 82552a55b..27265fa11 100644 --- a/intrastat_product/security/intrastat_security.xml +++ b/intrastat_product/security/intrastat_security.xml @@ -15,21 +15,33 @@ ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + >[('company_id', 'in', company_ids + [False])] Intrastat Region Company rule ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + >[('company_id', 'in', company_ids + [False])] + + + Intrastat Product Computation Lines Company rule + + [('parent_id.company_id', 'in', company_ids)] Intrastat Product Declaration Company rule + [('company_id', 'in', company_ids)] + + + Intrastat Product Declaration Lines Company rule + ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + >[('parent_id.company_id', 'in', company_ids)]