summaryrefslogtreecommitdiff
path: root/addons/project/tests
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-02-08 16:17:04 +0100
committerNicolas Lempereur <nle@odoo.com>2018-02-13 16:07:21 +0100
commitf19e0f8047392af4d51f41d4de6ef64c6f4ff33a (patch)
tree81e1633b62e46ad011686bc8f90a59fce9812bce /addons/project/tests
parentca0875231ff5f5b308f2c901e78e34af7d7c8bf2 (diff)
[FIX] project: set as favorite
- Connect as a user with only 'User' rights on projects - Set a project as favorite (click the star) The project is not set as favorite. Since only project managers are allowed to write on projects, the field `is_favorite` is set as read-only. Therefore, it is filtered out by `_generateChanges`, and nothing happens. First step is to set the attribute `force_save` in the view, so the RPC `write` call is forced. Second step is to compute directly the inverse thus bypassing access rights. Co-authored-by: Nicolas Lempereur <nle@odoo.com> opw-814604 opw-801587 closes #22938
Diffstat (limited to 'addons/project/tests')
-rw-r--r--addons/project/tests/test_access_rights.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/project/tests/test_access_rights.py b/addons/project/tests/test_access_rights.py
index 0e3cc8cfb6e..ad31ccbb8b7 100644
--- a/addons/project/tests/test_access_rights.py
+++ b/addons/project/tests/test_access_rights.py
@@ -53,6 +53,15 @@ class TestPortalProject(TestPortalProjectBase):
tmp_task.sudo(self.user_projectuser).unlink()
@mute_logger('odoo.addons.base.ir.ir_model')
+ def test_favorite_project_access_rights(self):
+ pigs = self.project_pigs.sudo(self.user_projectuser)
+
+ # we can't write on project name
+ self.assertRaises(AccessError, pigs.write, {'name': 'False Pigs'})
+ # we can write on is_favorite
+ pigs.write({'is_favorite': True})
+
+ @mute_logger('odoo.addons.base.ir.ir_model')
def test_followers_project_access_rights(self):
pigs = self.project_pigs
pigs.write({'privacy_visibility': 'followers'})