Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions base_import_manager/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
===================
Base Import Manager
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2b831fb7d42be7ffd6c57a83b6239ed1ba995848e84926554b504ffec2650348
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/18.0/base_import_manager
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-18-0/server-ux-18-0-base_import_manager
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-ux&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the import capability:

1. It adds an "Import Access" permission field on model access rights
(``ir.model.access``).
2. It disables the import option in list and kanban views if the user
does not have import access for the target model.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure import access:

1. Activate developer mode.
2. Go to **Settings > Users > Groups** and select a user group.
3. Edit the group and go to the **Access Rights** tab.
4. Uncheck the **Import Access** checkbox for the target model and save.

Alternatively, you can manage this setting directly under **Settings >
Technical > Security > Access Rights**.

Usage
=====

Once import access is configured for a group:

1. Log in as a user who belongs to a group that does not have "Import
Access" for a specific model.
2. Go to the list or kanban view for that model.
3. The "Import" option will not be displayed or accessible in the user
interface.

Known issues / Roadmap
======================

- None.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/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
`feedback <https://github.com/OCA/server-ux/issues/new?body=module:%20base_import_manager%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* CIT Services

Contributors
------------

- `CIT-Services <cit-services.eu>`__

- Prayag <prayag.k@cit-services.eu>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/18.0/base_import_manager>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions base_import_manager/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2026 CIT Services
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
19 changes: 19 additions & 0 deletions base_import_manager/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2026 CIT Services
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Base Import Manager",
"summary": "Manage Import Access per Group",
"category": "Tools",
"version": "18.0.1.0.0",
"depends": ["base_import"],
"website": "https://github.com/OCA/server-ux",
"author": "CIT Services, Odoo Community Association (OCA)",
"data": [
"views/ir_model_access.xml",
"views/res_groups.xml",
],
"installable": True,
"application": False,
"license": "AGPL-3",
}
5 changes: 5 additions & 0 deletions base_import_manager/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2026 CIT Services
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import ir_model_access
from . import ir_ui_view
10 changes: 10 additions & 0 deletions base_import_manager/models/ir_model_access.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2026 CIT Services
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class IrModelAccess(models.Model):
_inherit = "ir.model.access"

perm_import = fields.Boolean("Import Access", default=True)
43 changes: 43 additions & 0 deletions base_import_manager/models/ir_ui_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2026 CIT Services
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class IrUiView(models.Model):
_inherit = "ir.ui.view"

def _get_import_group_ids(self):
"""Helper to get user group IDs for import check.
Overridden by role integration."""
return self.env.user.groups_id.ids

def _postprocess_access_rights(self, tree):
"""Disable the import action based on the user's
effective model access rights."""
target_model = tree.get("model_access_rights")
tree = super()._postprocess_access_rights(tree)

if not target_model or tree.tag not in ("list", "kanban"):
return tree

group_ids = self._get_import_group_ids()
has_import = bool(
self.env["ir.model.access"]
.sudo()
.search(
[
("model_id.model", "=", target_model),
("perm_import", "=", True),
"|",
("group_id", "=", False),
("group_id", "in", group_ids),
],
limit=1,
)
)

if not has_import:
tree.set("import", "0")

return tree
3 changes: 3 additions & 0 deletions base_import_manager/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
8 changes: 8 additions & 0 deletions base_import_manager/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To configure import access:

1. Activate developer mode.
2. Go to **Settings > Users > Groups** and select a user group.
3. Edit the group and go to the **Access Rights** tab.
4. Uncheck the **Import Access** checkbox for the target model and save.

Alternatively, you can manage this setting directly under **Settings > Technical > Security > Access Rights**.
2 changes: 2 additions & 0 deletions base_import_manager/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [CIT-Services](cit-services.eu)
- Prayag \<<prayag.k@cit-services.eu>\>
4 changes: 4 additions & 0 deletions base_import_manager/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module extends the import capability:

1. It adds an "Import Access" permission field on model access rights (`ir.model.access`).
2. It disables the import option in list and kanban views if the user does not have import access for the target model.
1 change: 1 addition & 0 deletions base_import_manager/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- None.
6 changes: 6 additions & 0 deletions base_import_manager/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Once import access is configured for a group:

1. Log in as a user who belongs to a group that does not have "Import Access" for a specific model.
2. Go to the list or kanban view for that model.
3. The "Import" option will not be displayed or accessible in the user interface.

Loading