Repository: akvo/akvo-rsr

Issue:
Submitting new qualitative indicator requires it to be saved first



Discussion:

Resolving patch:
diff --git a/akvo/rsr/models/__init__.py b/akvo/rsr/models/__init__.py
--- a/akvo/rsr/models/__init__.py
+++ b/akvo/rsr/models/__init__.py
@@ -215,6 +215,7 @@
 rules.add_perm('rsr.add_indicatorperiod', is_rsr_admin | is_org_admin | is_org_me_manager_or_project_editor)
 rules.add_perm('rsr.change_indicatorperiod', is_rsr_admin | is_org_admin | is_org_me_manager_or_project_editor)
 rules.add_perm('rsr.delete_indicatorperiod', is_rsr_admin | is_org_admin | is_org_me_manager_or_project_editor)
+rules.add_perm('rsr.do_me_manager_actions', is_rsr_admin | is_org_admin | is_org_me_manager)
 
 rules.add_perm('rsr.view_indicatorperioddata', is_rsr_admin | is_org_admin | is_org_me_manager)
 rules.add_perm(


Test patch:
diff --git a/akvo/rsr/tests/test_permissions.py b/akvo/rsr/tests/test_permissions.py
--- a/akvo/rsr/tests/test_permissions.py
+++ b/akvo/rsr/tests/test_permissions.py
@@ -110,6 +110,9 @@ def test_org_admin_permissions(self):
         self.assertTrue(user.has_perm('rsr.change_project', None))
         self.assertTrue(user.has_perm('rsr.change_partnersite'))
 
+        # "M&E manager" actions
+        self.assertTrue(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             test = self.assertTrue if i == 0 else self.assertFalse
@@ -195,6 +198,9 @@ def test_org_project_editor(self):
         # No object
         self.assertTrue(user.has_perm('rsr.change_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             test = self.assertTrue if i == 0 else self.assertFalse
@@ -279,6 +285,9 @@ def test_org_me_manager(self):
         # No object
         self.assertTrue(user.has_perm('rsr.change_project', None))
 
+        # "M&E manager" actions
+        self.assertTrue(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             test = self.assertTrue if i == 0 else self.assertFalse
@@ -363,6 +372,9 @@ def test_org_user_manager(self):
         # No object
         self.assertFalse(user.has_perm('rsr.change_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             self.assertFalse(user.has_perm('rsr.change_organisation', org))
@@ -435,6 +447,9 @@ def test_org_user_permissions(self):
         # None object permissions
         self.assertTrue(user.has_perm('rsr.view_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Test no permissions on None, if user doesn't have required employment
         self.assertFalse(user.has_perm('rsr.add_indicatorperioddata'))
 
@@ -460,6 +475,9 @@ def test_org_enumerator_permissions(self):
         # Permissions on None
         self.assertTrue(user.has_perm('rsr.view_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Project Update permissions
         for i, project_update in enumerate(self.project_updates):
             test = self.assertTrue if i == 0 else self.assertFalse