How to disable object deletion

Asked by Ivan Wirawan

Is it possible to disable object deletion for all users, without having to go through the object deletion access for each groups?

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
jerzyo (jerzyo) said :
#1

You can override unlik method to do nothing

Revision history for this message
Ivan Wirawan (niecw) said :
#2

Hi Jerzyo,

Thanks for the reply.

However the method that you have mentioned has one drawback that I want to avoid: it prompts a "Are you sure to remove those records?" (gtk-client) or "Do you really want to delete selected record(s) ?" (web-client) confirmation prompt.

The prompt certainly would confuse user if nothing happened (I actually raise an error in the unlink method to alert user that it cannot be done).

Appreciate if anyone has other means of disabling object deletion for all users, without having to go through the object deletion access for each groups?

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#3

Ivan,

You are right. Your aim completely obvious and many operators would want to get this feature done.

This can surely be handled from client side programming, but not from server side.

Thanks.

Revision history for this message
Ivan Wirawan (niecw) said :
#4

Hi,

Thank you for the reply. I guess there is currently no standard mechanism provided to achieve what I want in the framework.

As to whether this feature can be achieved from client side or server side programming, it is debatable. In a true MVC framework, the client (view) should not have the knowledge of business logic, which is to be supplied by the Controller (server side in OpenObject Framework??? - CMIIW). Similar flow of information has been used if object deletion is disable for all users, it is a matter of granularity of access rights.

What currently is provided by OpenObjects are:
- Granularity of CRUD by user group
- Granularity of field access by user group by way of domain (changing the readonly attribute of a field using a domain statement)

But there is no (CMIIW):
- Global/System-wide CRUD accessibility (especially deletion - the one that I need)

Revision history for this message
Lorenzo Battistini (elbati) said :
#5

In ir.model.access, if you specify that only 'base.group_no_one' (for instance) can delete your object, every other group won't be able to delete. Isn't it so?

Revision history for this message
Ivan Wirawan (niecw) said :
#6

Hi Lorenzo,

Thank you for the suggestion. It does prevent a user from deleting the object (aside from overriding unlink method) but, alas even if the user does not have delete access to the object, the UI (both web and gtk) enable the delete button and the prompt I mentioned above still appear before an exception is prompted.

So, I guess it IS client side programming rather than server side after all.

Anyway, thanks everyone. I don't intend to mark this problem solved as it is not solved. However I would 'abandon' this thread. Hopefully it is fixed in the next release.

Can you help with this problem?

Provide an answer of your own, or ask Ivan Wirawan for more information if necessary.

To post a message you must log in.