3
0
Fork 0
web_techsystech/web_access_rule_buttons
Guewen Baconnier fa5e879757 Skip check on TransientModels without ID
Fix:

Traceback (most recent call last):
  File "/opt/odoo/src/openerp/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/src/openerp/http.py", line 680, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/src/openerp/http.py", line 316, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/src/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/src/openerp/http.py", line 309, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/src/openerp/http.py", line 959, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/src/openerp/http.py", line 509, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/src/addons/web/controllers/main.py", line 893, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/src/addons/web/controllers/main.py", line 885, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/odoo/src/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/src/openerp/api.py", line 381, in old_api
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/external-src/web/web_access_rule_buttons/models.py", line 24, in check_access_rule_all
    result[operation] = True
  File "/opt/odoo/src/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/src/openerp/api.py", line 574, in new_api
    result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
  File "/opt/odoo/src/openerp/models.py", line 3554, in check_access_rule
    WHERE id IN %%s""" % self._table, (tuple(ids),))
  File "/opt/odoo/src/openerp/sql_db.py", line 139, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/odoo/src/openerp/sql_db.py", line 218, in execute
    res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near ")"
LINE 3:                           WHERE id IN ()
2016-03-01 13:42:25 +01:00
..
static/src/js Check if button is defined and use .prop() 2016-01-11 12:02:39 +01:00
views Add web_access_rule_buttons 2016-01-05 17:03:37 +01:00
README.rst Add web_access_rule_buttons 2016-01-05 17:03:37 +01:00
__init__.py Add web_access_rule_buttons 2016-01-05 17:03:37 +01:00
__openerp__.py Add web_access_rule_buttons 2016-01-05 17:03:37 +01:00
models.py Skip check on TransientModels without ID 2016-03-01 13:42:25 +01:00

README.rst

.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
   :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
   :alt: License: AGPL-3

========================
Web Access Rules Buttons
========================

This addon disables the Edit button on the form views if the user
cannot edit the current record according to the record access rules.


Usage
=====

When using Odoo, even if a user has no rights to edit a record, the Edit button
is shown. The user can edit the record but won't be able to save his changes.
Now, the user won't be able to click on the Edit button.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
   :alt: Try me on Runbot
   :target: https://runbot.odoo-community.org/runbot/162/9.0

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

* Additional requests will be issued when a record is loaded in a form view in
  order to check if the user has the access right.

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
web/issues/new?body=module:%20
web_access_rule_buttons%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

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

* Guewen Baconnier <guewen.baconnier@camptocamp.com>

Maintainer
----------

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

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.