Commit 046ab070 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Allow Accountant is Auditor of Regularisation Requests

   Since Regularisation Request is created by lack of payment, usually the accountant is the one that can reply about ways of payments, and the one that can include manual payment (ie.: Wired transfer).

   Future possible use cases (Regularisation Request for Org?) would require accountant help to handle payments.

   Update related tests.
parent 1752f078
<local_roles_item>
<local_roles>
<role id='F-ACCOUNTING*'>
<item>Auditor</item>
</role>
<role id='F-CUSTOMER'>
<item>Auditor</item>
</role>
......@@ -9,6 +12,7 @@
</local_roles>
<local_role_group_ids>
<local_role_group_id id='function'>
<principal id='F-ACCOUNTING*'>Auditor</principal>
<principal id='F-CUSTOMER'>Auditor</principal>
<principal id='F-SALE*'>Auditor</principal>
</local_role_group_id>
......
<type_roles>
<role id='Auditor'>
<property id='title'>Accounting</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Customer</property>
<multi_property id='categories'>local_role_group/function</multi_property>
......
<type_roles>
<role id='Auditor'>
<property id='title'>Accounting</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Customer</property>
<property id='condition'>python: context.getDestinationDecision('', portal_type='Person') != ""</property>
......
......@@ -1116,38 +1116,59 @@ class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test_RegularisationRequestModule(self):
module = self.portal.regularisation_request_module
self.assertSecurityGroup(module,
['F-SALE*', 'F-CUSTOMER', module.Base_getOwnerId()], True)
['F-SALE*', 'F-CUSTOMER', 'F-ACCOUNTING*', module.Base_getOwnerId()], True)
self.assertRoles(module, 'F-SALE*', ['Auditor'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin):
ticket_portal_type = 'Regularisation Request'
def test_RegularisationRequest_default(self):
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
ticket = 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'])
self.assertSecurityGroup(ticket,
[self.user_id, 'F-SALEAGT', 'F-SALEMAN', 'F-ACCOUNTING*'], False)
self.assertRoles(ticket, self.user_id, ['Owner'])
self.assertRoles(ticket, 'F-SALEMAN', ['Assignor'])
self.assertRoles(ticket, 'F-SALEAGT', ['Assignee'])
self.assertRoles(ticket, 'F-ACCOUNTING*', ['Auditor'])
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(
ticket = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.edit(
ticket.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'])
self.assertSecurityGroup(ticket,
[person.getUserId(), self.user_id, 'F-SALEAGT',
'F-SALEMAN', 'F-ACCOUNTING*'], False)
self.assertRoles(ticket, person.getUserId(), ['Auditor'])
self.assertRoles(ticket, self.user_id, ['Owner'])
self.assertRoles(ticket, 'F-SALEMAN', ['Assignor'])
self.assertRoles(ticket, 'F-SALEAGT', ['Assignee'])
self.assertRoles(ticket, 'F-ACCOUNTING*', ['Auditor'])
def test_RegularisationRequest_organisation(self):
reference = 'TESTORG-%s' % self.generateNewId()
org = self.portal.organisation_module.newContent(
portal_type='Organisation',
reference=reference)
ticket = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
ticket.edit(
destination_decision_value=org,
)
self.assertSecurityGroup(ticket,
[self.user_id, 'F-SALEAGT', 'F-SALEMAN', 'F-ACCOUNTING*'], False)
self.assertRoles(ticket, self.user_id, ['Owner'])
self.assertRoles(ticket, 'F-SALEMAN', ['Assignor'])
self.assertRoles(ticket, 'F-SALEAGT', ['Assignee'])
self.assertRoles(ticket, 'F-ACCOUNTING*', ['Auditor'])
class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin):
......@@ -1688,6 +1709,20 @@ class TestSubscriptionRequest(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(delivery, person.getUserId(), ['Associate'])
self.assertRoles(delivery, "SHADOW-%s" % person.getUserId(), ['Auditor'])
def test_SubscriptionRequest_organisation(self):
# Ensure compatibility if destination_decision is an org
reference = 'TESTORG-%s' % self.generateNewId()
org = self.portal.organisation_module.newContent(
portal_type='Organisation', reference=reference)
delivery = self.portal.subscription_request_module.newContent(
portal_type='Subscription Request')
delivery.edit(destination_decision_value=org, ledger="automated")
self.assertSecurityGroup(delivery,
['F-SALE*', 'F-ACCOUNTING*', self.user_id], False)
self.assertRoles(delivery, self.user_id, ['Owner'])
self.assertRoles(delivery, 'F-SALE*', ['Auditor'])
self.assertRoles(delivery, 'F-ACCOUNTING*', ['Auditor'])
class TestSubscriptionChangeRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test_SubscriptionChangeRequestModule(self):
module = self.portal.subscription_change_request_module
......
......@@ -26,9 +26,7 @@
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -84,17 +82,4 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: context.Base_hasSlapOSProjectUserGroup(project_relation=\'source_project\', manager=True, agent=True, customer=True)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -26,9 +26,7 @@
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -84,17 +82,4 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: context.Base_hasSlapOSProjectUserGroup(project_relation=\'source_project\', manager=True, agent=True, customer=True)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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