Commit 2f2bad3a authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: give read access to Open Order to sale/accountant people

parent 0c2e2d58
<local_roles_item> <local_roles_item>
<local_roles> <local_roles>
<role id='G-COMPANY'> <role id='F-ACCOUNTING*'>
<item>Auditor</item>
</role>
<role id='F-SALE*'>
<item>Auditor</item> <item>Auditor</item>
<item>Author</item>
</role> </role>
</local_roles> </local_roles>
<local_role_group_ids> <local_role_group_ids>
<local_role_group_id id='group'> <local_role_group_id id='function'>
<principal id='G-COMPANY'>Auditor</principal> <principal id='F-ACCOUNTING*'>Auditor</principal>
<principal id='G-COMPANY'>Author</principal> <principal id='F-SALE*'>Auditor</principal>
</local_role_group_id> </local_role_group_id>
</local_role_group_ids> </local_role_group_ids>
</local_roles_item> </local_roles_item>
\ No newline at end of file
<type_roles> <type_roles>
<role id='Author; Auditor'> <role id='Auditor'>
<property id='title'>Group company</property> <property id='title'>Accountant</property>
<multi_property id='categories'>local_role_group/group</multi_property> <multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>group/company</multi_property> <multi_property id='category'>function/accounting*</multi_property>
<multi_property id='base_category'>group</multi_property> <multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Sale</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/sale*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role> </role>
</type_roles> </type_roles>
\ No newline at end of file
<type_roles> <type_roles>
<role id='Auditor'>
<property id='title'>Accountant</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'>Sale</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/sale*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>User</property> <property id='title'>User</property>
<property id='condition'>python: (here.getDestinationSection('', portal_type='Person') != '') and (context.getLedger("") == "automated")</property> <property id='condition'>python: (here.getDestinationSection('', portal_type='Person') != '') and (context.getLedger("") == "automated")</property>
......
...@@ -1380,7 +1380,6 @@ class TestSalePackingListModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1380,7 +1380,6 @@ class TestSalePackingListModule(TestSlapOSGroupRoleSecurityMixin):
['F-SALE*', 'F-ACCOUNTING*', module.Base_getOwnerId()], False) ['F-SALE*', 'F-ACCOUNTING*', module.Base_getOwnerId()], False)
self.assertRoles(module, 'F-SALE*', ['Auditor']) self.assertRoles(module, 'F-SALE*', ['Auditor'])
self.assertRoles(module, 'F-ACCOUNTING*', ['Auditor']) self.assertRoles(module, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(module, 'F-SALE*', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner']) self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
...@@ -1394,3 +1393,62 @@ class TestSalePackingList(TestSlapOSGroupRoleSecurityMixin): ...@@ -1394,3 +1393,62 @@ class TestSalePackingList(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(delivery, 'F-SALE*', ['Auditor']) self.assertRoles(delivery, 'F-SALE*', ['Auditor'])
self.assertRoles(delivery, 'F-ACCOUNTING*', ['Auditor']) self.assertRoles(delivery, 'F-ACCOUNTING*', ['Auditor'])
class TestOpenSaleOrderModule(TestSlapOSGroupRoleSecurityMixin):
def test_OpenSaleOrderModule(self):
module = self.portal.open_sale_order_module
self.assertSecurityGroup(module,
['F-SALE*', 'F-ACCOUNTING*', module.Base_getOwnerId()], False)
self.assertRoles(module, 'F-SALE*', ['Auditor'])
self.assertRoles(module, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
class TestOpenSaleOrder(TestSlapOSGroupRoleSecurityMixin):
def test_OpenSaleOrder_default(self):
delivery = self.portal.open_sale_order_module.newContent(
portal_type='Open Sale Order')
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'])
def test_OpenSaleOrder_user(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
delivery = self.portal.open_sale_order_module.newContent(
portal_type='Open Sale Order')
delivery.edit(
ledger='automated',
destination_section_value=person
)
self.assertSecurityGroup(delivery,
['F-SALE*', 'F-ACCOUNTING*', self.user_id, person.getUserId()], False)
self.assertRoles(delivery, self.user_id, ['Owner'])
self.assertRoles(delivery, 'F-SALE*', ['Auditor'])
self.assertRoles(delivery, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(delivery, person.getUserId(), ['Auditor'])
delivery.edit(
ledger=None
)
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'])
delivery.edit(
ledger='automated',
destination_section_value=None
)
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'])
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<key> <string>trigger_method_id</string> </key> <key> <string>trigger_method_id</string> </key>
<value> <value>
<tuple> <tuple>
<string>_setDestination.*</string> <string>_setDestinationSection.*</string>
<string>_setLedger.*</string> <string>_setLedger.*</string>
</tuple> </tuple>
</value> </value>
......
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