Commit 6c538622 authored by Romain Courteaud's avatar Romain Courteaud

Allow user to access his invoice.

parent 840c3c39
...@@ -4,4 +4,10 @@ ...@@ -4,4 +4,10 @@
<multi_property id='category'>group/company</multi_property> <multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property> <multi_property id='base_category'>group</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>User</property>
<property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
<type>Person</type> <type>Person</type>
<workflow>local_permission_slapos_interaction_workflow</workflow> <workflow>local_permission_slapos_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Sale Invoice Transaction</type>
<workflow>local_permission_slapos_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Slave Instance</type> <type>Slave Instance</type>
<workflow>local_permission_slapos_interaction_workflow</workflow> <workflow>local_permission_slapos_interaction_workflow</workflow>
......
...@@ -905,6 +905,22 @@ class TestSaleInvoiceTransaction(TestSlapOSGroupRoleSecurityMixin): ...@@ -905,6 +905,22 @@ class TestSaleInvoiceTransaction(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
def test_User(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction')
product.edit(
destination_section_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', self.user_id, reference], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, reference, ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestServiceModule(TestSlapOSGroupRoleSecurityMixin): class TestServiceModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.service_module module = self.portal.service_module
......
...@@ -319,3 +319,19 @@ class TestSlapOSLocalPermissionSlapOSInteractionWorkflow( ...@@ -319,3 +319,19 @@ class TestSlapOSLocalPermissionSlapOSInteractionWorkflow(
Folder.recursiveReindexObject = Folder.recursiveReindexObject_call Folder.recursiveReindexObject = Folder.recursiveReindexObject_call
self.assertEqual(comment, self.assertEqual(comment,
integration_site.workflow_history['edit_workflow'][-1]['comment']) integration_site.workflow_history['edit_workflow'][-1]['comment'])
def test_SaleInvoiceTransaction_setDestinationSection(self):
self._makePerson()
sale_invoice_transaction = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction')
self.assertSecurityGroup(sale_invoice_transaction, [self.user_id,
'G-COMPANY'],
False)
sale_invoice_transaction.edit(
destination_section=self.person_user.getRelativeUrl())
transaction.commit()
self.assertSecurityGroup(sale_invoice_transaction, [self.user_id,
'G-COMPANY', self.person_user.getReference()],
False)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>Base_updateAllLocalRoles</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleInvoiceTransaction_edit</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setDestinationSection.*</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Sale Invoice Transaction</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
151 152
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,7 @@ Integration Site | local_permission_slapos_interaction_workflow ...@@ -6,6 +6,7 @@ Integration Site | local_permission_slapos_interaction_workflow
Payment Transaction | local_permission_slapos_interaction_workflow Payment Transaction | local_permission_slapos_interaction_workflow
Payzen Event | local_permission_slapos_interaction_workflow Payzen Event | local_permission_slapos_interaction_workflow
Person | local_permission_slapos_interaction_workflow Person | local_permission_slapos_interaction_workflow
Sale Invoice Transaction | local_permission_slapos_interaction_workflow
Slave Instance | local_permission_slapos_interaction_workflow Slave Instance | local_permission_slapos_interaction_workflow
Software Installation | local_permission_slapos_interaction_workflow Software Installation | local_permission_slapos_interaction_workflow
Software Instance | local_permission_slapos_interaction_workflow Software Instance | local_permission_slapos_interaction_workflow
\ No newline at end of file
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