Odoo Help

0

0
4 Answers
1
Avatar

Mitul Shingala

--Mitul Shingala--
--Mitul Shingala--

Odoo Developer

Mitul Shingala
24-04-19 02:15

Hello

there are many way to achieve this.

1. into the tree/form view of the contact add the delete attribute. 

    like <tree delete="0"> . for the form <form delete="0">

2. remove the users access rights of users for the delete the contact from menu "Access Rights"

3. override fields_view_get, you can also remove the option for the "delete" from "Action Drop Down"

4. override the unlink. using this you have option "delete" in "Action" dropdown. but using override unlink method  you can raise error, so user cannot delete contact.

I hope this answer will helps you.

0
Claudio Zayas
24-04-19 09:20

Dear Mitul and Samo, first of all, thanks for your help. Here's my problem:

Initially I tried to solve the problem by removing (in Ajustments \ Database Structure \ Models \ res.partner) the permission to delete in the res.partner model, but it did not allow users to delete the contacts created in the "Contacts and addresses" form the Contacts form, which should be allowed. That's why I had to give them back access to delete contacts.

The problem arises when it is detected that a group of contracts had the partner_id field in blank, which is an error because the Contracts module has this field as mandatory.

So to verify this inconsistency, I tried to eliminate a client with a Contract in the Contacts module and the Odoo allowed it, leaving the partner_id field in blank in their respective contract.

For this reason I want to limit the possibility that a normal user can eliminate contacts.

On the other hand my programming knowledge in Odoo is very limited, I have been learning Odoo for only 3 months, so I ask you to give me examples of a piece of code to understand, for example, where I should put:

  like <tree delete = "0">. for the form <form delete = "0">

or

how "i can override fields_view_get, you can also remove the option for the "delete" from "Action Drop Down""

or 

how Samo "overriding the unlink method for the res_partner. I added an if that checks if the user has group for root the it allows to delete the record, else it raises a validation error"

Thanks you very much in advance!

Iam working with Odoo 11.0


1 Opmerking
Mitul Shingala
25-04-19 02:04

while you create the tree view or form view you have to pass the attribute delete

like <tree delete="0"> and <form delete="0">

0
Samo Arko
24-04-19 01:47

I did it with overriding the unlink method for the res_partner. I added an if that checks if the user has group for root the it allows to delete the record, else it raises a validation error.

Stel een vraag
Writer
Labels
Keep Informed
1 volger(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now