Commit c692331f authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: sale agt/manager can handle Regularisation/Support Request

parent 4bba1b8d
......@@ -29,6 +29,18 @@
<multi_property id='category'>role/member</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Assignee'>
<property id='title'>Sale Agent</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/sale/agent</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignor'>
<property id='title'>Sale Manager</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/sale/manager</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignee'>
<property id='title'>Source Project Production Agent</property>
<property id='description'>XXX add local role group</property>
......
......@@ -951,8 +951,10 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
self.assertSecurityGroup(support_request,
[self.user_id], False)
[self.user_id, 'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
def test_SupportRequest_Customer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
......@@ -964,9 +966,11 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
destination_decision_value=person,
)
self.assertSecurityGroup(support_request,
[person.getUserId(), self.user_id], False)
[person.getUserId(), self.user_id, 'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, person.getUserId(), ['Auditor'])
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
def test_SupportRequest_Template(self):
support_request = self.portal.restrictedTraverse(getattr(
......@@ -1017,9 +1021,79 @@ class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
class TestRegularisationRequest(TestSupportRequest):
class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin):
ticket_portal_type = 'Regularisation Request'
def test_RegularisationRequest_default(self):
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
self.assertSecurityGroup(support_request,
[self.user_id, 'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
def test_RegularisationRequest_Customer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.edit(
destination_decision_value=person,
)
self.assertSecurityGroup(support_request,
[person.getUserId(), self.user_id, 'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, person.getUserId(), ['Auditor'])
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
def test_RegularisationRequest_Template(self):
support_request = self.portal.restrictedTraverse(getattr(
self.portal.portal_preferences,
'getPreferred%sTemplate' % self.ticket_portal_type.title().replace(' ', '')
)())
assert support_request.getPortalType() == self.ticket_portal_type
self.assertSecurityGroup(support_request,
[support_request.Base_getOwnerId(), 'R-MEMBER'], False)
self.assertRoles(support_request, support_request.Base_getOwnerId(), ['Owner'])
self.assertRoles(support_request, 'R-MEMBER', ['Auditor'])
self.assertPermissionsOfRole(support_request, 'Auditor',
['Access contents information', 'View'])
def test_RegularisationRequest_SourceProject(self):
project = self.addProject()
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.edit(
source_project_value=project)
self.assertSecurityGroup(support_request, [self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference(),
'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(support_request, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
def test_RegularisationRequest_DestinationProject(self):
project = self.addProject()
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.edit(
destination_project_value=project)
self.assertSecurityGroup(support_request, [self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference(),
'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(support_request, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin):
def test_SystemEventModule(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment