{"id":9249,"date":"2024-10-03T06:08:20","date_gmt":"2024-10-03T06:08:20","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=9249"},"modified":"2024-10-03T06:56:18","modified_gmt":"2024-10-03T06:56:18","slug":"give-project-edit-permission-in-odoo-17-with-ease-guide","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/give-project-edit-permission-in-odoo-17-with-ease-guide\/","title":{"rendered":"Give Project Edit Permission in Odoo 17 with Ease | Guide"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 2,205<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>To grant a project user group user the ability to edit a project if they are the project manager in Odoo 17, you can follow these steps by customizing the access control rules:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create a custom security rule<\/strong>: You need to add a custom rule to the project model that checks if the current user is the project manager.<\/li>\n\n\n\n<li><strong>Update the access rights<\/strong>: Adjust the access rights so that only project managers can edit the project they are managing.<\/li>\n<\/ol>\n\n\n\n<p>Here\u2019s an outline of what needs to be done in Odoo 17:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step-by-Step Instructions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Define a Record Rule<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to <code><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">Settings<\/mark><\/code> > <code><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">Technical<\/mark><\/code> > <code><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">Security<\/mark><\/code> > <code><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">Record Rules<\/mark><\/code>.<\/li>\n\n\n\n<li>Create a new record rule that allows users in the &#8220;Project User&#8221; group to edit a project if they are the manager. The domain filter could be like this:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&#91;('user_id', '=', user.id)]<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>This will ensure that the logged-in user can edit only the projects they manage.<\/p>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Assign the Rule to the Project User Group<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the same rule, make sure to assign it to the &#8220;Project User&#8221; group or the specific group you want to target.<\/li>\n\n\n\n<li>Set the access rights (write access) for this group.<\/li>\n<\/ul>\n\n\n\n<p>    3. <strong>Example Code<\/strong> (Custom Python rule for models):<br>If you want to customize it programmatically, you can modify the access control via custom Python code in a custom module. In your <code><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">models\/project.py<\/mark><\/code>:<\/p>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\"><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">from odoo import models, fields\n\n   class Project(models.Model):\n       _inherit = 'project.project'\n\n       def check_project_edit_rights(self):\n           # Check if the current user is the project manager\n           if self.user_id == self.env.user:\n               return True\n           return False<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>In your <code><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">security\/ir.model.access.csv<\/mark><\/code>, define access rules accordingly.<\/p>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>Testing<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After setting up the record rule, test by logging in as a project user who is also a project manager and confirm they can edit only their own projects.<\/li>\n<\/ul>\n\n\n\n<p>This approach will restrict project editing to only project managers, ensuring proper permissions are maintained in Odoo 17.<\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>To simply grant a specific project user group, utilize the proficiency to easily edit any project if they are the project manager, especially in Odoo 17. You can obey all these above-mentioned steps by tailoring the access control guidelines with <a href=\"https:\/\/www.infinitivehost.com\/managed-odoo-server-solutions\"><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\"><strong>managed Odoo server solutions<\/strong><\/mark><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2,205 Views To grant a project user group user the ability to edit a project if they are the project manager in Odoo 17, you can follow these steps by customizing the access control rules: Here\u2019s an outline of what needs to be done in Odoo 17: Step-by-Step Instructions This will ensure that the logged-in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[203],"tags":[],"class_list":["post-9249","post","type-post","status-publish","format-standard","hentry","category-odoo"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=9249"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9249\/revisions"}],"predecessor-version":[{"id":9253,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9249\/revisions\/9253"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=9249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=9249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=9249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}