Commit 40621071 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Use destination_section for payment transactions

   Destination is never set... Destination Section is a proper value for the condition.
parent 4f7f8cbe
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Shadow User</property> <property id='title'>Shadow User</property>
<property id='condition'>python: (here.getDestination('', portal_type='Person') != "") and (here.getLedger("") == "automated")</property> <property id='condition'>python: (here.getDestinationSection('', portal_type='Person') != "") and (here.getLedger("") == "automated")</property>
<property id='base_category_script'>Base_getSecurityCategoryAsShadowUser</property> <property id='base_category_script'>Base_getSecurityCategoryAsShadowUser</property>
<multi_property id='categories'>local_role_group/shadow</multi_property> <multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>destination_section</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>User</property> <property id='title'>User</property>
<property id='condition'>python: (here.getDestination('', portal_type='Person') != '') and (context.getLedger("") == "automated")</property> <property id='condition'>python: (here.getDestinationSection('', portal_type='Person') != '') and (context.getLedger("") == "automated")</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>destination_section</multi_property>
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Writable for Accountant Agent</property> <property id='title'>Writable for Accountant Agent</property>
......
...@@ -196,7 +196,7 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin): ...@@ -196,7 +196,7 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
product = self.portal.accounting_module.newContent( product = self.portal.accounting_module.newContent(
portal_type='Payment Transaction') portal_type='Payment Transaction')
product.edit( product.edit(
destination_value=person, destination_section_value=person,
ledger='automated' ledger='automated'
) )
shadow_user_id = 'SHADOW-%s' % person.getUserId() shadow_user_id = 'SHADOW-%s' % person.getUserId()
...@@ -209,9 +209,6 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin): ...@@ -209,9 +209,6 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
def test_PaymentTransaction_OrganisationLedger(self): def test_PaymentTransaction_OrganisationLedger(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='TESTORGA-%s' % self.generateNewId() title='TESTORGA-%s' % self.generateNewId()
...@@ -219,18 +216,13 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin): ...@@ -219,18 +216,13 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
product = self.portal.accounting_module.newContent( product = self.portal.accounting_module.newContent(
portal_type='Payment Transaction') portal_type='Payment Transaction')
product.edit( product.edit(
destination_value=person,
destination_section_value=organisation, destination_section_value=organisation,
ledger='automated' ledger='automated'
) )
shadow_user_id = 'SHADOW-%s' % person.getUserId()
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
['F-ACCOUNTING*', 'R-SHADOW-PERSON', self.user_id, person.getUserId(), ['F-ACCOUNTING*', 'R-SHADOW-PERSON', self.user_id ], False)
shadow_user_id], False)
self.assertRoles(product, 'F-ACCOUNTING*', ['Auditor']) self.assertRoles(product, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(product, 'R-SHADOW-PERSON', ['Assignee']) self.assertRoles(product, 'R-SHADOW-PERSON', ['Assignee'])
self.assertRoles(product, shadow_user_id, ['Assignee'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
......
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