Commit 350ea7e7 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: fix Purchase Invoice Transaction security

parent a5a2f5de
......@@ -3,14 +3,21 @@
<property id='title'>ReadOnly for Accountant</property>
<property id='condition'>python: context.getLedger("") == "automated"</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting</multi_property>
<multi_property id='category'>function/accounting*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignee'>
<property id='title'>Writable for Accountant Agent</property>
<property id='condition'>python: context.getLedger("") != "automated"</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'>Writable for Accountant</property>
<property id='title'>Writable for Accountant Manager</property>
<property id='condition'>python: context.getLedger("") != "automated"</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting</multi_property>
<multi_property id='category'>function/accounting/manager</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles>
\ No newline at end of file
......@@ -1402,13 +1402,24 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(product, self.user_id, ['Owner'])
class TestPurchaseInvoiceTransaction(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
def test_AccountingFunction_LedgerNotAutomated(self):
product = self.portal.accounting_module.newContent(
portal_type='Purchase Invoice Transaction')
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
['F-ACCMAN', 'F-ACCAGT', self.user_id], False)
self.assertRoles(product, 'F-ACCMAN', ['Assignor'])
self.assertRoles(product, 'F-ACCAGT', ['Assignee'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_AccountingFunction_LedgerAutomated(self):
product = self.portal.accounting_module.newContent(
portal_type='Purchase Invoice Transaction')
product.edit(ledger='automated')
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['F-ACCOUNTING*', self.user_id], False)
self.assertRoles(product, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestSaleInvoiceTransaction(TestSlapOSGroupRoleSecurityMixin):
......
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