Skip to content
Merged
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
82 changes: 82 additions & 0 deletions access_fast/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
===========
Access Fast
===========

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

.. |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-tegin%2Fcb--addons-lightgray.png?logo=github
:target: https://github.com/tegin/cb-addons/tree/16.0/access_fast
:alt: tegin/cb-addons

|badge1| |badge2| |badge3|

This addon allows to retrieve specific records through queries.

This module define generic flow to access records fastly through URL patterns.
So, you can define new actions to access different models and records just by defining new actions.

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to:

#. Go to Settings > Technical > Database Structure > Access Fast
#. Create a new Access Fast Action, defining:

- **Key**: A unique identifier for the action.
- **Model**: The model to access.
- **Field**: The field used to search the record (e.g., 'name', 'code').

Usage
=====

To use this module, you need to:

#. Open a session in Odoo with a user that has access to the target model.
#. Use the following URL pattern to access a record: /access_fast/<key>/<field_value>

- **<key>**: The key defined in the Access Fast Action.
- **<field_value>**: The value of the field to search the record.

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

Bugs are tracked on `GitHub Issues <https://github.com/tegin/cb-addons/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/tegin/cb-addons/issues/new?body=module:%20access_fast%0Aversion:%2016.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
~~~~~~~

* Dixmit
* CreuBlanca

Maintainers
~~~~~~~~~~~

This module is part of the `tegin/cb-addons <https://github.com/tegin/cb-addons/tree/16.0/access_fast>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions access_fast/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
19 changes: 19 additions & 0 deletions access_fast/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Access Fast",
"summary": """This addon allows retrieving specific records through queries.""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Dixmit,CreuBlanca",
"website": "https://github.com/tegin/cb-addons",
"depends": [
"base",
],
"data": [
"security/ir.model.access.csv",
"views/ir_access_fast_views.xml",
],
"demo": [],
}
1 change: 1 addition & 0 deletions access_fast/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
35 changes: 35 additions & 0 deletions access_fast/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import http
from odoo.http import request


class AccessFastController(http.Controller):
@http.route(
"/access_fast/<string:action_code>/<string:code>",
type="http",
methods=["GET"],
csrf=False,
)
def access_fast(self, action_code, code, **kwargs):

action = request.env["ir.access.fast"].search(
[("name", "=", action_code)], limit=1
)
if not action:
return request.make_response(
"Action not found", headers=[("Content-Type", "text/plain")], status=404
)

record = (
request.env[action.model_id.model]
.sudo()
.search([(action.field_id.name or "name", "=", code)], limit=1)
)
if not record:
return request.make_response(
"Record not found", headers=[("Content-Type", "text/plain")], status=404
)

return request.redirect(f"/web#model={action.model_id.model}&id={record.id}")
1 change: 1 addition & 0 deletions access_fast/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_access_fast
22 changes: 22 additions & 0 deletions access_fast/models/ir_access_fast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class IrAccessFast(models.Model):
_name = "ir.access.fast"
_description = "IR Access Fast Model"

name = fields.Char(required=True)
model_id = fields.Many2one("ir.model", required=True, ondelete="cascade")
field_id = fields.Many2one(
"ir.model.fields",
domain="[('model_id', '=', model_id)]",
required=True,
ondelete="cascade",
)

_sql_constraints = [
("name_unique", "unique(name)", "The name must be unique."),
]
3 changes: 3 additions & 0 deletions access_fast/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 access_fast/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To configure this module, you need to:

#. Go to Settings > Technical > Database Structure > Access Fast
#. Create a new Access Fast Action, defining:

- **Key**: A unique identifier for the action.
- **Model**: The model to access.
- **Field**: The field used to search the record (e.g., 'name', 'code').
4 changes: 4 additions & 0 deletions access_fast/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This addon allows to retrieve specific records through queries.

This module define generic flow to access records fastly through URL patterns.
So, you can define new actions to access different models and records just by defining new actions.
7 changes: 7 additions & 0 deletions access_fast/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To use this module, you need to:

#. Open a session in Odoo with a user that has access to the target model.
#. Use the following URL pattern to access a record: /access_fast/&lt;key&gt;/&lt;field_value&gt;

- **&lt;key&gt;**: The key defined in the Access Fast Action.
- **&lt;field_value&gt;**: The value of the field to search the record.
3 changes: 3 additions & 0 deletions access_fast/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_fast_user,access_fast_user,model_ir_access_fast,base.group_user,1,0,0,0
access_fast_manager,access_fast_manager,model_ir_access_fast,base.group_erp_manager,1,1,1,1
Loading