From b6005772f7eda42071e00b799fe6ab5fdec0d000 Mon Sep 17 00:00:00 2001 From: emjay0921 Date: Tue, 9 Jun 2026 11:19:20 +0800 Subject: [PATCH 1/4] feat(registry): add Registry Settings section and consolidate registry config (#1009) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New 'Registry Settings' section in the Settings app (spp_registry), mirroring 'Programs Settings', carrying the 'Restrict Registry Edits to Admin Only' toggle. - The toggle keeps both legacy config-parameter keys (spp_farmer_registry.registry_admin_only_crud and spp_starter.registry_admin_only_crud) in sync via get_values/set_values, so the spp_farmer_registry and spp_starter_sp_mis controllers keep reading their own key — no migration, no enforcement change. Removed the now-duplicate 'Farmer Registry Settings' and 'SP-MIS Settings' sections and their field definitions. - Relocated the API V2 and Import Match menus out of Registry > Configuration into a new 'Registry' group under the Settings app (Settings > Registry), and updated the API V2 security compliance manifest to match. --- spp_api_v2/security/compliance.yaml | 4 +- spp_api_v2/views/menu.xml | 4 +- spp_farmer_registry/__manifest__.py | 1 - spp_farmer_registry/models/__init__.py | 1 - .../models/res_config_settings.py | 17 ------ .../views/res_config_settings_views.xml | 23 -------- spp_import_match/views/import_match_view.xml | 2 +- spp_registry/__manifest__.py | 1 + spp_registry/models/__init__.py | 1 + spp_registry/models/res_config_settings.py | 51 ++++++++++++++++ spp_registry/tests/__init__.py | 1 + .../tests/test_res_config_settings.py | 53 +++++++++++++++++ .../views/res_config_settings_views.xml | 59 +++++++++++++++++++ spp_starter_sp_mis/__manifest__.py | 1 - spp_starter_sp_mis/models/__init__.py | 1 - .../models/res_config_settings.py | 17 ------ .../views/res_config_settings_views.xml | 37 ------------ 17 files changed, 171 insertions(+), 103 deletions(-) delete mode 100644 spp_farmer_registry/models/res_config_settings.py delete mode 100644 spp_farmer_registry/views/res_config_settings_views.xml create mode 100644 spp_registry/models/res_config_settings.py create mode 100644 spp_registry/tests/test_res_config_settings.py create mode 100644 spp_registry/views/res_config_settings_views.xml delete mode 100644 spp_starter_sp_mis/models/res_config_settings.py delete mode 100644 spp_starter_sp_mis/views/res_config_settings_views.xml diff --git a/spp_api_v2/security/compliance.yaml b/spp_api_v2/security/compliance.yaml index fff4e0e36..e90abf127 100644 --- a/spp_api_v2/security/compliance.yaml +++ b/spp_api_v2/security/compliance.yaml @@ -162,10 +162,10 @@ record_rules: [] menus: # Root menu - visible to all API V2 users - # Located under Registry > Configuration + # Located under Settings > Registry (OP#1009) - id: menu_api_v2_root name: "API V2" - parent: spp_registry.spp_configuration_menu_root + parent: spp_registry.menu_registry_settings_root groups: [group_api_v2_viewer] # API Clients submenu diff --git a/spp_api_v2/views/menu.xml b/spp_api_v2/views/menu.xml index 5d998d23b..34f619f40 100644 --- a/spp_api_v2/views/menu.xml +++ b/spp_api_v2/views/menu.xml @@ -1,10 +1,10 @@ - + diff --git a/spp_farmer_registry/__manifest__.py b/spp_farmer_registry/__manifest__.py index e17bfd40b..2a360b87c 100644 --- a/spp_farmer_registry/__manifest__.py +++ b/spp_farmer_registry/__manifest__.py @@ -43,7 +43,6 @@ "data/cel_constants.xml", "data/config_parameters.xml", "data/user_roles.xml", - "views/res_config_settings_views.xml", "views/farm_season_views.xml", "views/farm_details_views.xml", "views/farm_activity_views.xml", diff --git a/spp_farmer_registry/models/__init__.py b/spp_farmer_registry/models/__init__.py index a93481592..9db98934c 100644 --- a/spp_farmer_registry/models/__init__.py +++ b/spp_farmer_registry/models/__init__.py @@ -5,4 +5,3 @@ from . import farm_activity from . import farm_asset from . import farm -from . import res_config_settings diff --git a/spp_farmer_registry/models/res_config_settings.py b/spp_farmer_registry/models/res_config_settings.py deleted file mode 100644 index 55eda5d74..000000000 --- a/spp_farmer_registry/models/res_config_settings.py +++ /dev/null @@ -1,17 +0,0 @@ -# Part of OpenSPP. See LICENSE file for full copyright and licensing details. - -from odoo import fields, models - - -class ResConfigSettings(models.TransientModel): - _inherit = "res.config.settings" - - is_registry_admin_only_crud = fields.Boolean( - "Restrict Registry Create/Edit/Delete to Admin Only", - help=( - "Only administrators can add, modify, or remove registrants. " - "Other users can still view all registry data but cannot make changes." - ), - default=True, - config_parameter="spp_farmer_registry.registry_admin_only_crud", - ) diff --git a/spp_farmer_registry/views/res_config_settings_views.xml b/spp_farmer_registry/views/res_config_settings_views.xml deleted file mode 100644 index ceb765c21..000000000 --- a/spp_farmer_registry/views/res_config_settings_views.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - res.config.settings.view.form.inherit.farmer_registry - res.config.settings - - - - - - - - - - - - - - diff --git a/spp_import_match/views/import_match_view.xml b/spp_import_match/views/import_match_view.xml index 32488a9ce..87c181641 100644 --- a/spp_import_match/views/import_match_view.xml +++ b/spp_import_match/views/import_match_view.xml @@ -138,7 +138,7 @@ id="menu_spp_import_match" name="Import Match" action="action_spp_import_match" - parent="spp_registry.spp_configuration_menu_root" + parent="spp_registry.menu_registry_settings_root" sequence="1000" groups="spp_security.group_spp_admin" /> diff --git a/spp_registry/__manifest__.py b/spp_registry/__manifest__.py index c5ad486f1..1b5339a65 100644 --- a/spp_registry/__manifest__.py +++ b/spp_registry/__manifest__.py @@ -42,6 +42,7 @@ "wizard/disable_registrant_view.xml", # Views - Base "views/main_view.xml", + "views/res_config_settings_views.xml", "views/reg_relationship_view.xml", "views/reg_id_view.xml", "views/id_types_view.xml", diff --git a/spp_registry/models/__init__.py b/spp_registry/models/__init__.py index ca222d231..46184ab09 100644 --- a/spp_registry/models/__init__.py +++ b/spp_registry/models/__init__.py @@ -9,4 +9,5 @@ from . import reg_relationship from . import registrant from . import registry_config +from . import res_config_settings from . import res_users diff --git a/spp_registry/models/res_config_settings.py b/spp_registry/models/res_config_settings.py new file mode 100644 index 000000000..71d8e96a5 --- /dev/null +++ b/spp_registry/models/res_config_settings.py @@ -0,0 +1,51 @@ +# Part of OpenSPP. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + +# Legacy config-parameter keys this toggle keeps in sync. The starter modules' +# controllers still read their own key (spp_farmer_registry reads the first, +# spp_starter_sp_mis reads the second), so the central "Registry Settings" +# toggle writes both — no migration or controller change needed, and neither +# deployment's enforcement breaks. +_LEGACY_KEYS = ( + "spp_farmer_registry.registry_admin_only_crud", + "spp_starter.registry_admin_only_crud", +) + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + is_registry_admin_only_crud = fields.Boolean( + "Restrict Registry Create/Edit/Delete to Admin Only", + default=True, + help=( + "Only administrators can add, modify, or remove registrants. " + "Other users can still view all registry data but cannot make changes." + ), + ) + + def get_values(self): + res = super().get_values() + # ir.config_parameter is a global system setting; sudo is the standard + # access pattern for reading it. + icp = self.env["ir.config_parameter"].sudo() # nosemgrep: odoo-sudo-without-context + # A deployment ships only one of the two starter controllers, so at most + # one key is set. Reflect an explicit value if present; otherwise fall + # back to the secure default (True), matching the legacy + # config_parameter default the starters used. + explicit = [v for v in (icp.get_param(key) for key in _LEGACY_KEYS) if v is not False] + res["is_registry_admin_only_crud"] = any(v == "True" for v in explicit) if explicit else True + return res + + def set_values(self): + res = super().set_values() + # ir.config_parameter is a global system setting; sudo is the standard + # access pattern for writing it. + icp = self.env["ir.config_parameter"].sudo() # nosemgrep: odoo-sudo-without-context + value = "True" if self.is_registry_admin_only_crud else "False" + # Keep both legacy keys in sync so whichever starter controller is + # installed reads the value the operator set here. + for key in _LEGACY_KEYS: + icp.set_param(key, value) + return res diff --git a/spp_registry/tests/__init__.py b/spp_registry/tests/__init__.py index c76f4067f..2177f1fd9 100644 --- a/spp_registry/tests/__init__.py +++ b/spp_registry/tests/__init__.py @@ -12,3 +12,4 @@ from . import test_membership_constraints from . import test_registrant_misc from . import test_group_aggregation +from . import test_res_config_settings diff --git a/spp_registry/tests/test_res_config_settings.py b/spp_registry/tests/test_res_config_settings.py new file mode 100644 index 000000000..fc5d9d03d --- /dev/null +++ b/spp_registry/tests/test_res_config_settings.py @@ -0,0 +1,53 @@ +# Part of OpenSPP. See LICENSE file for full copyright and licensing details. +"""Tests for the central Registry Settings (OP#1009). + +The "Restrict Registry Edits to Admin Only" toggle lives in spp_registry and +keeps both legacy config-parameter keys in sync so whichever starter +controller is installed reads the operator's choice. +""" + +from odoo.tests import TransactionCase, tagged + +FARMER_KEY = "spp_farmer_registry.registry_admin_only_crud" +SPMIS_KEY = "spp_starter.registry_admin_only_crud" + + +@tagged("post_install", "-at_install") +class TestRegistryResConfigSettings(TransactionCase): + """Registry admin-only-CRUD toggle: default + dual-key sync.""" + + def _icp(self): + return self.env["ir.config_parameter"].sudo() + + def _clear_keys(self): + self._icp().search([("key", "in", [FARMER_KEY, SPMIS_KEY])]).unlink() + + def test_defaults_true_when_unset(self): + """With neither legacy key set, the toggle defaults to True (secure).""" + self._clear_keys() + settings = self.env["res.config.settings"].create({}) + self.assertTrue(settings.is_registry_admin_only_crud) + + def test_set_values_writes_both_keys(self): + """Saving the toggle writes BOTH legacy keys so either controller reads it.""" + settings = self.env["res.config.settings"].create({"is_registry_admin_only_crud": True}) + settings.execute() + self.assertEqual(self._icp().get_param(FARMER_KEY), "True") + self.assertEqual(self._icp().get_param(SPMIS_KEY), "True") + + settings = self.env["res.config.settings"].create({"is_registry_admin_only_crud": False}) + settings.execute() + self.assertEqual(self._icp().get_param(FARMER_KEY), "False") + self.assertEqual(self._icp().get_param(SPMIS_KEY), "False") + + def test_get_values_reflects_an_explicit_key(self): + """An explicit value on either legacy key is reflected in the toggle.""" + self._clear_keys() + self._icp().set_param(SPMIS_KEY, "False") + settings = self.env["res.config.settings"].create({}) + self.assertFalse(settings.is_registry_admin_only_crud) + + self._clear_keys() + self._icp().set_param(FARMER_KEY, "True") + settings = self.env["res.config.settings"].create({}) + self.assertTrue(settings.is_registry_admin_only_crud) diff --git a/spp_registry/views/res_config_settings_views.xml b/spp_registry/views/res_config_settings_views.xml new file mode 100644 index 000000000..704be05c2 --- /dev/null +++ b/spp_registry/views/res_config_settings_views.xml @@ -0,0 +1,59 @@ + + + + + res.config.settings.view.form.inherit.registry + res.config.settings + + + + + + + + + + + + + + + + + + Settings + ir.actions.act_window + res.config.settings + + form + current + {'module': 'registry_settings'} + + + + + + + diff --git a/spp_starter_sp_mis/__manifest__.py b/spp_starter_sp_mis/__manifest__.py index 254a020a8..6cf87174d 100644 --- a/spp_starter_sp_mis/__manifest__.py +++ b/spp_starter_sp_mis/__manifest__.py @@ -22,7 +22,6 @@ ], "data": [ "data/config_parameters.xml", - "views/res_config_settings_views.xml", ], "assets": { "web.assets_backend": [ diff --git a/spp_starter_sp_mis/models/__init__.py b/spp_starter_sp_mis/models/__init__.py index cdb421fac..441611e10 100644 --- a/spp_starter_sp_mis/models/__init__.py +++ b/spp_starter_sp_mis/models/__init__.py @@ -1,2 +1 @@ # Part of OpenSPP. See LICENSE file for full copyright and licensing details. -from . import res_config_settings diff --git a/spp_starter_sp_mis/models/res_config_settings.py b/spp_starter_sp_mis/models/res_config_settings.py deleted file mode 100644 index 86a6520d8..000000000 --- a/spp_starter_sp_mis/models/res_config_settings.py +++ /dev/null @@ -1,17 +0,0 @@ -# Part of OpenSPP. See LICENSE file for full copyright and licensing details. - -from odoo import fields, models - - -class ResConfigSettings(models.TransientModel): - _inherit = "res.config.settings" - - is_registry_admin_only_crud = fields.Boolean( - "Restrict Registry Create/Edit/Delete to Admin Only", - help=( - "Only administrators can add, modify, or remove registrants. " - "Other users can still view all registry data but cannot make changes." - ), - default=True, - config_parameter="spp_starter.registry_admin_only_crud", - ) diff --git a/spp_starter_sp_mis/views/res_config_settings_views.xml b/spp_starter_sp_mis/views/res_config_settings_views.xml deleted file mode 100644 index 330f4241b..000000000 --- a/spp_starter_sp_mis/views/res_config_settings_views.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - res.config.settings.view.form.inherit.sp_mis - res.config.settings - - - - - - - - - - - - - - - - SP-MIS Settings - ir.actions.act_window - res.config.settings - - form - current - {'module': 'spp_starter_sp_mis'} - - From d6e6d2fa18fa280c57c96a61cd4a655e432f06bc Mon Sep 17 00:00:00 2001 From: emjay0921 Date: Fri, 17 Jul 2026 11:10:15 +0800 Subject: [PATCH 2/4] feat(registry): relocate Configuration menu to Settings > Registry (#1009) --- spp_registry/__manifest__.py | 5 ++++- spp_registry/views/main_view.xml | 9 ++++++++- spp_registry/views/res_config_settings_views.xml | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/spp_registry/__manifest__.py b/spp_registry/__manifest__.py index 1b5339a65..d13dc6190 100644 --- a/spp_registry/__manifest__.py +++ b/spp_registry/__manifest__.py @@ -41,8 +41,11 @@ # Wizards "wizard/disable_registrant_view.xml", # Views - Base - "views/main_view.xml", + # res_config_settings_views.xml defines menu_registry_settings_root, which + # main_view.xml reparents the Configuration menu under (OP#1009), so it + # must load first. "views/res_config_settings_views.xml", + "views/main_view.xml", "views/reg_relationship_view.xml", "views/reg_id_view.xml", "views/id_types_view.xml", diff --git a/spp_registry/views/main_view.xml b/spp_registry/views/main_view.xml index 7f84415d3..e8b46863a 100644 --- a/spp_registry/views/main_view.xml +++ b/spp_registry/views/main_view.xml @@ -12,10 +12,17 @@ groups="spp_security.group_spp_admin,spp_registry.group_registry_manager,spp_registry.group_registry_officer,spp_registry.group_registry_viewer" /> + diff --git a/spp_registry/views/res_config_settings_views.xml b/spp_registry/views/res_config_settings_views.xml index 704be05c2..25372c25c 100644 --- a/spp_registry/views/res_config_settings_views.xml +++ b/spp_registry/views/res_config_settings_views.xml @@ -56,4 +56,20 @@ action="res_config_settings_menu_registry_action" groups="spp_security.group_spp_admin" /> + + + + + From 6d55270dd3374d1277c8a39d86ab88c0bcb1977a Mon Sep 17 00:00:00 2001 From: emjay0921 Date: Mon, 24 Aug 2026 11:10:22 +0800 Subject: [PATCH 3/4] docs: regenerate READMEs for the Registry Settings consolidation Five modules' changelog entries, plus spp_starter_sp_mis's description, which still advertised the toggle field that moved into Registry Settings. --- spp_api_v2/README.rst | 7 ++++ spp_api_v2/static/description/index.html | 33 ++++++++++++------- spp_farmer_registry/README.rst | 8 +++++ .../static/description/index.html | 15 +++++++-- spp_import_match/README.rst | 7 ++++ .../static/description/index.html | 12 +++++-- spp_registry/README.rst | 10 ++++++ spp_registry/static/description/index.html | 17 ++++++++-- .../tests/test_res_config_settings.py | 18 +++++----- .../views/res_config_settings_views.xml | 30 +++++++++-------- spp_starter_sp_mis/README.rst | 32 +++++++++++++----- .../static/description/index.html | 32 +++++++++++++----- 12 files changed, 160 insertions(+), 61 deletions(-) diff --git a/spp_api_v2/README.rst b/spp_api_v2/README.rst index 6e15b9b92..26a40cefc 100644 --- a/spp_api_v2/README.rst +++ b/spp_api_v2/README.rst @@ -147,6 +147,13 @@ Dependencies Changelog ========= +19.0.2.1.1 +~~~~~~~~~~ + +- chore(api_v2): the API V2 configuration menu moved from Registry > + Configuration to Settings > Registry, alongside the other superuser + configuration (#1009) + 19.0.2.1.0 ~~~~~~~~~~ diff --git a/spp_api_v2/static/description/index.html b/spp_api_v2/static/description/index.html index 6980d735b..433b44e60 100644 --- a/spp_api_v2/static/description/index.html +++ b/spp_api_v2/static/description/index.html @@ -517,19 +517,28 @@

Dependencies

Changelog

-

19.0.2.1.0

+

19.0.2.1.1

+
    +
  • chore(api_v2): the API V2 configuration menu moved from Registry > +Configuration to Settings > Registry, alongside the other superuser +configuration (#1009)
  • +
+
+
+

19.0.2.1.0

  • Add OpenAPI polymorphic schema utilities (utils/openapi_polymorphic.py): polymorphic_body() for @@ -554,8 +563,8 @@

    19.0.2.1.0

    polymorphic utilities, and the overall OpenAPI document contract
-
-

19.0.2.0.1

+
+

19.0.2.0.1

  • Fix SerializationFailure race when multiple Odoo workers rebuild their routing map simultaneously (e.g. after -u all) and all try @@ -570,15 +579,15 @@

    19.0.2.0.1

    regressions are diagnosable without raising the global log level
-
-

19.0.2.0.0

+
+

19.0.2.0.0

  • Initial migration to OpenSPP2
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -586,7 +595,7 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

diff --git a/spp_farmer_registry/README.rst b/spp_farmer_registry/README.rst index 56b61cb7c..62768bd9b 100644 --- a/spp_farmer_registry/README.rst +++ b/spp_farmer_registry/README.rst @@ -68,6 +68,14 @@ Model Description Changelog ========= +19.0.2.0.4 +~~~~~~~~~~ + +- chore(farmer_registry): the duplicate Farmer Registry Settings section + is removed — the toggle it carried now lives in Registry Settings, and + this module's storage key is written in step with it, so enforcement + is unchanged (#1009) + 19.0.2.0.3 ~~~~~~~~~~ diff --git a/spp_farmer_registry/static/description/index.html b/spp_farmer_registry/static/description/index.html index 6d2852191..17174d3a6 100644 --- a/spp_farmer_registry/static/description/index.html +++ b/spp_farmer_registry/static/description/index.html @@ -436,6 +436,15 @@

Changelog

+

19.0.2.0.4

+
    +
  • chore(farmer_registry): the duplicate Farmer Registry Settings section +is removed — the toggle it carried now lives in Registry Settings, and +this module’s storage key is written in step with it, so enforcement +is unchanged (#1009)
  • +
+
+

19.0.2.0.3

  • fix(farm): remove the farm membership-completeness warnings entirely — @@ -447,7 +456,7 @@

    19.0.2.0.3

    per #1113 no such warnings should be shown (#1113)
-
+

19.0.2.0.2

  • fix(security): align Farm User / Farm Manager roles with the OP#951 @@ -458,7 +467,7 @@

    19.0.2.0.2

    spp_hazard and spp_gis_report to module dependencies.
-
+

19.0.2.0.1

  • fix(views): apply spp_registry.x2many_no_padding widget to the @@ -466,7 +475,7 @@

    19.0.2.0.1

    placeholder rows Odoo 19 inserts on inline list-in-form views (#943).
-
+

19.0.2.0.0

  • Initial migration to OpenSPP2
  • diff --git a/spp_import_match/README.rst b/spp_import_match/README.rst index 611fee984..f03c11050 100644 --- a/spp_import_match/README.rst +++ b/spp_import_match/README.rst @@ -393,6 +393,13 @@ Test 12: Security — Non-Admin Access Changelog ========= +19.0.2.0.3 +~~~~~~~~~~ + +- chore(import_match): the Import Match menu moved from Registry > + Configuration to Settings > Registry, alongside the other superuser + configuration (#1009) + 19.0.2.0.2 ~~~~~~~~~~ diff --git a/spp_import_match/static/description/index.html b/spp_import_match/static/description/index.html index dff790529..a6172f2aa 100644 --- a/spp_import_match/static/description/index.html +++ b/spp_import_match/static/description/index.html @@ -804,6 +804,14 @@

    Changelog

+

19.0.2.0.3

+
    +
  • chore(import_match): the Import Match menu moved from Registry > +Configuration to Settings > Registry, alongside the other superuser +configuration (#1009)
  • +
+
+

19.0.2.0.2

  • chore(views): hide the conditional-gate columns (Is Conditional, @@ -813,7 +821,7 @@

    19.0.2.0.2

    UI until a real use case lands.
-
+

19.0.2.0.1

  • fix(matching): add a condition_field_id Many2one column to @@ -825,7 +833,7 @@

    19.0.2.0.1

    zero matches.
-
+

19.0.2.0.0

  • Initial migration to OpenSPP2
  • diff --git a/spp_registry/README.rst b/spp_registry/README.rst index a9369ecd9..fed1aade5 100644 --- a/spp_registry/README.rst +++ b/spp_registry/README.rst @@ -139,6 +139,16 @@ Dependencies Changelog ========= +19.0.2.2.1 +~~~~~~~~~~ + +- feat(registry): registry configuration is consolidated into one + **Registry Settings** section in the Settings app, with the Restrict + Registry Edits toggle and the relocated superuser configuration menus + (API V2, Import Match). Changing the toggle needs a Settings + administrator; the section's menu is gated to match, since the + framework refuses a settings save from anyone else (#1009) + 19.0.2.1.4 ~~~~~~~~~~ diff --git a/spp_registry/static/description/index.html b/spp_registry/static/description/index.html index 0e6786338..e232ebded 100644 --- a/spp_registry/static/description/index.html +++ b/spp_registry/static/description/index.html @@ -518,6 +518,17 @@

    Changelog

+

19.0.2.2.1

+
    +
  • feat(registry): registry configuration is consolidated into one +Registry Settings section in the Settings app, with the Restrict +Registry Edits toggle and the relocated superuser configuration menus +(API V2, Import Match). Changing the toggle needs a Settings +administrator; the section’s menu is gated to match, since the +framework refuses a settings save from anyone else (#1009)
  • +
+
+

19.0.2.1.4

  • fix(registry): remove the dead @api.constrains("age") @@ -529,7 +540,7 @@

    19.0.2.1.4

    dropped
-
+

19.0.2.1.3

  • fix(registry): show an ID Status column on the group form @@ -540,7 +551,7 @@

    19.0.2.1.3

    (#1110)
-
+

19.0.2.1.1

  • fix(views): add reusable x2many_no_padding JS widget that @@ -550,7 +561,7 @@

    19.0.2.1.1

    don’t bloat the layout (#943).
-
+

19.0.2.0.0

  • Initial migration to OpenSPP2
  • diff --git a/spp_registry/tests/test_res_config_settings.py b/spp_registry/tests/test_res_config_settings.py index 414e4e5e7..377f379c2 100644 --- a/spp_registry/tests/test_res_config_settings.py +++ b/spp_registry/tests/test_res_config_settings.py @@ -78,11 +78,12 @@ def _user(self, login, *group_xmlids): def test_saving_requires_a_settings_administrator(self): """res.config.settings.execute() refuses anyone who is not an Odoo admin. - `if not self.env.is_admin(): raise AccessError(...)`, and is_admin means - superuser or base.group_erp_manager. The OpenSPP admin and - registry-config-admin groups have neither, and granting them - group_erp_manager would be a privilege escalation — so the menu is gated - to match, and this pins the behaviour that gating reflects. + Two gates, and the earlier one is the harder: res.config.settings' ACL + grants create only to base.group_system, so these personas cannot even + open the form — and execute() would refuse them afterwards anyway, + since is_admin means superuser or base.group_erp_manager. Neither group + has either, and granting one would be a privilege escalation, so the + menu is gated to match and this pins the behaviour it reflects. """ for groups in ( ("spp_security.group_spp_admin",), @@ -90,13 +91,12 @@ def test_saving_requires_a_settings_administrator(self): ): with self.subTest(groups=groups): user = self._user("cfg_" + groups[0].split(".")[-1][:20], *groups) - settings = self.env["res.config.settings"].with_user(user).create({}) with self.assertRaises(AccessError): - settings.execute() + self.env["res.config.settings"].with_user(user).create({}).execute() def test_a_settings_administrator_can_save(self): - admin = self._user("cfg_erp_manager", "base.group_erp_manager") + admin = self._user("cfg_settings_admin", "base.group_system") settings = self.env["res.config.settings"].with_user(admin).create( {"is_registry_admin_only_crud": False} ) @@ -110,7 +110,7 @@ def test_the_general_settings_menu_is_gated_on_who_can_save(self): """Offering the menu more widely means a form that throws on Save.""" menu = self.env.ref("spp_registry.menu_registry_settings_general") - self.assertIn(self.env.ref("base.group_erp_manager"), menu.group_ids) + self.assertIn(self.env.ref("base.group_system"), menu.group_ids) def test_the_relocated_configuration_menus_stay_available(self): """Those are ordinary actions with their own gates — they do work.""" diff --git a/spp_registry/views/res_config_settings_views.xml b/spp_registry/views/res_config_settings_views.xml index 391351ff9..d451da601 100644 --- a/spp_registry/views/res_config_settings_views.xml +++ b/spp_registry/views/res_config_settings_views.xml @@ -50,20 +50,22 @@ />