Commit 4486252e authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_trade: add cancel state/transition

parent 2c407c9f
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StateDefinition" module="Products.DCWorkflow.States"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>cancelled</string> </value>
</item>
<item>
<key> <string>permission_roles</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Cancelled</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>Access contents information</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>Add portal content</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>View</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -27,7 +27,10 @@
<item>
<key> <string>transitions</string> </key>
<value>
<tuple/>
<tuple>
<string>cancel</string>
<string>cancel_action</string>
</tuple>
</value>
</item>
<item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></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>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>cancel</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>cancelled</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Cancel Inventory Report</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Cancel Inventory Report</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=cancel_action</string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>cancel</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>cancel_action</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Calcal Inventory Report Acton</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -611,17 +611,24 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
"""
"""
if not run: return
self.createUser('test_creator',
['Auditor', 'Author'])
user_id_list = ['test_user', 'manager']
user_id_list = ['test_creator', 'test_user', 'manager']
for user in user_id_list:
self.failUnlessUserCanAddDocument(user, self.getInventoryReportModule())
self.login(user_id_list[0])
inventory_report = self.getInventoryReportModule().newContent(portal_type='Inventory Report')
self.login()
for user in user_id_list:
self.failUnlessUserCanAddDocument(user, inventory_report)
inventory_report_line = inventory_report.newContent(portal_type='Inventory Report Line')
self.assertEqual(inventory_report.getSimulationState(), 'draft')
self.tic()
for user in user_id_list:
self.login(user)
self.assertEqual(self.portal.portal_workflow.isTransitionPossible(inventory_report, 'calculate'), True)
......@@ -631,7 +638,6 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
inventory_report.calculate()
self.tic()
self.assertEqual(inventory_report.getSimulationState(), 'calculating')
for user in user_id_list:
self.login(user)
self.assertEqual(self.portal.portal_workflow.isTransitionPossible(inventory_report, 'record'), True)
......@@ -646,13 +652,32 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
self.login(user)
self.assertEqual(self.portal.portal_workflow.isTransitionPossible(inventory_report, 'calculate'), False)
self.failIfUserCanModifyDocument('test_user', inventory_report)
self.failUnlessUserCanViewDocument('test_user', inventory_report)
self.failIfUserCanModifyDocument('test_user', inventory_report_line)
self.failUnlessUserCanViewDocument('test_user', inventory_report_line)
self.login()
self.failIfUserCanPassWorkflowTransition(user_id_list[0], 'cancel_action', inventory_report)
for user in user_id_list[1:]:
self.failUnlessUserCanPassWorkflowTransition(user, 'cancel_action', inventory_report)
for user in user_id_list[:-1]:
self.failIfUserCanModifyDocument(user, inventory_report)
self.failUnlessUserCanViewDocument(user, inventory_report)
self.failIfUserCanModifyDocument(user, inventory_report_line)
self.failUnlessUserCanViewDocument(user, inventory_report_line)
self.failUnlessUserCanModifyDocument('manager', inventory_report)
self.failUnlessUserCanModifyDocument('manager', inventory_report_line)
inventory_report.cancel()
self.tic()
self.assertEqual(inventory_report.getSimulationState(), 'cancelled')
for user in user_id_list[:-1]:
self.failIfUserCanModifyDocument(user, inventory_report)
self.failUnlessUserCanViewDocument(user, inventory_report)
self.failIfUserCanModifyDocument(user, inventory_report_line)
self.failUnlessUserCanViewDocument(user, inventory_report_line)
self.failUnlessUserCanModifyDocument('manager', inventory_report)
self.failUnlessUserCanModifyDocument('manager', inventory_report_line)
def test_02_checkCalculateProduct(self, run=run_all_test):
"""
......
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