Commit b6851783 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Accountant is assignor/assignee on 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.

   Accounting Agent is assignee (like sales agent)
   Accounting Manager is assignor (Like sales manager)

   Only Assignor can re-open (pause) the process to destroy unpaid instances.
parent b9b542f0
<local_roles_item> <local_roles_item>
<local_roles> <local_roles>
<role id='F-ACCOUNTING*'>
<item>Auditor</item>
</role>
<role id='F-CUSTOMER'> <role id='F-CUSTOMER'>
<item>Auditor</item> <item>Auditor</item>
</role> </role>
...@@ -9,6 +12,7 @@ ...@@ -9,6 +12,7 @@
</local_roles> </local_roles>
<local_role_group_ids> <local_role_group_ids>
<local_role_group_id id='function'> <local_role_group_id id='function'>
<principal id='F-ACCOUNTING*'>Auditor</principal>
<principal id='F-CUSTOMER'>Auditor</principal> <principal id='F-CUSTOMER'>Auditor</principal>
<principal id='F-SALE*'>Auditor</principal> <principal id='F-SALE*'>Auditor</principal>
</local_role_group_id> </local_role_group_id>
......
<type_roles> <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'> <role id='Auditor'>
<property id='title'>Project Customer</property> <property id='title'>Project Customer</property>
<multi_property id='categories'>local_role_group/function</multi_property> <multi_property id='categories'>local_role_group/function</multi_property>
......
<type_roles> <type_roles>
<role id='Assignee'>
<property id='title'>Accounting Agent</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting/agent</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignor'>
<property id='title'>Accounting Manager</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting/manager</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='condition'>python: context.getDestinationDecision('', portal_type='Person') != ""</property> <property id='condition'>python: context.getDestinationDecision('', portal_type='Person') != ""</property>
......
...@@ -1116,39 +1116,62 @@ class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1116,39 +1116,62 @@ class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test_RegularisationRequestModule(self): def test_RegularisationRequestModule(self):
module = self.portal.regularisation_request_module module = self.portal.regularisation_request_module
self.assertSecurityGroup(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-SALE*', ['Auditor'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor']) self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner']) self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin): class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin):
ticket_portal_type = 'Regularisation Request' ticket_portal_type = 'Regularisation Request'
def test_RegularisationRequest_default(self): 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) portal_type=self.ticket_portal_type)
self.assertSecurityGroup(support_request, self.assertSecurityGroup(ticket,
[self.user_id, 'F-SALEAGT', 'F-SALEMAN'], False) [self.user_id, 'F-SALEAGT', 'F-SALEMAN', 'F-ACCMAN', 'F-ACCAGT'], False)
self.assertRoles(support_request, self.user_id, ['Owner']) self.assertRoles(ticket, self.user_id, ['Owner'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor']) self.assertRoles(ticket, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee']) self.assertRoles(ticket, 'F-SALEAGT', ['Assignee'])
self.assertRoles(ticket, 'F-ACCMAN', ['Assignor'])
self.assertRoles(ticket, 'F-ACCAGT', ['Assignee'])
def test_RegularisationRequest_Customer(self): def test_RegularisationRequest_Customer(self):
reference = 'TESTPERSON-%s' % self.generateNewId() reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person', person = self.portal.person_module.newContent(portal_type='Person',
reference=reference) 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) portal_type=self.ticket_portal_type)
support_request.edit( ticket.edit(
destination_decision_value=person, destination_decision_value=person,
) )
self.assertSecurityGroup(support_request, self.assertSecurityGroup(ticket,
[person.getUserId(), self.user_id, 'F-SALEAGT', 'F-SALEMAN'], False) [person.getUserId(), self.user_id, 'F-SALEAGT',
self.assertRoles(support_request, person.getUserId(), ['Auditor']) 'F-SALEMAN', 'F-ACCMAN', 'F-ACCAGT'], False)
self.assertRoles(support_request, self.user_id, ['Owner']) self.assertRoles(ticket, person.getUserId(), ['Auditor'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor']) self.assertRoles(ticket, self.user_id, ['Owner'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee']) self.assertRoles(ticket, 'F-SALEMAN', ['Assignor'])
self.assertRoles(ticket, 'F-SALEAGT', ['Assignee'])
self.assertRoles(ticket, 'F-ACCMAN', ['Assignor'])
self.assertRoles(ticket, 'F-ACCAGT', ['Assignee'])
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-ACCMAN', 'F-ACCAGT'], False)
self.assertRoles(ticket, self.user_id, ['Owner'])
self.assertRoles(ticket, 'F-SALEMAN', ['Assignor'])
self.assertRoles(ticket, 'F-SALEAGT', ['Assignee'])
self.assertRoles(ticket, 'F-ACCMAN', ['Assignor'])
self.assertRoles(ticket, 'F-ACCAGT', ['Assignee'])
class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin): class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin):
def test_SystemEventModule(self): def test_SystemEventModule(self):
...@@ -1688,6 +1711,20 @@ class TestSubscriptionRequest(TestSlapOSGroupRoleSecurityMixin): ...@@ -1688,6 +1711,20 @@ class TestSubscriptionRequest(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(delivery, person.getUserId(), ['Associate']) self.assertRoles(delivery, person.getUserId(), ['Associate'])
self.assertRoles(delivery, "SHADOW-%s" % person.getUserId(), ['Auditor']) 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): class TestSubscriptionChangeRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test_SubscriptionChangeRequestModule(self): def test_SubscriptionChangeRequestModule(self):
module = self.portal.subscription_change_request_module module = self.portal.subscription_change_request_module
......
...@@ -26,9 +26,7 @@ ...@@ -26,9 +26,7 @@
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -84,17 +82,4 @@ ...@@ -84,17 +82,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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> </ZopeData>
...@@ -26,9 +26,7 @@ ...@@ -26,9 +26,7 @@
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -84,17 +82,4 @@ ...@@ -84,17 +82,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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> </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