Commit 75d9d71d authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_project: update milestone update also task

parent 04094226
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<type>Project Line</type> <type>Project Line</type>
<workflow>edit_workflow</workflow> <workflow>edit_workflow</workflow>
</chain> </chain>
<chain>
<type>Project Milestone</type>
<workflow>edit_workflow, milestone_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Requirement</type> <type>Requirement</type>
<workflow>edit_workflow, requirement_analysis_workflow</workflow> <workflow>edit_workflow, requirement_analysis_workflow</workflow>
......
...@@ -305,7 +305,7 @@ class TestProject(ERP5TypeTestCase): ...@@ -305,7 +305,7 @@ class TestProject(ERP5TypeTestCase):
self.assertEqual(project.project_milestone_1.getQuantityUnit(),'time/day') self.assertEqual(project.project_milestone_1.getQuantityUnit(),'time/day')
self.tic() self.tic()
def testTaskUpdateProjectMilestone(self): def test_UpdateProjectMilestone_task(self):
# Create Tasks # Create Tasks
task_module = self.getPortalObject().task_module task_module = self.getPortalObject().task_module
project = self.getPortalObject().project_module.Project_3 project = self.getPortalObject().project_module.Project_3
...@@ -358,6 +358,17 @@ class TestProject(ERP5TypeTestCase): ...@@ -358,6 +358,17 @@ class TestProject(ERP5TypeTestCase):
predecessor_value_list = project.project_milestone_task_milestone_2.getPredecessorValueList() predecessor_value_list = project.project_milestone_task_milestone_2.getPredecessorValueList()
self.assertEqual(len(predecessor_value_list), task_milestone_2_length + 1) self.assertEqual(len(predecessor_value_list), task_milestone_2_length + 1)
self.assertTrue(task in predecessor_value_list) self.assertTrue(task in predecessor_value_list)
project.project_milestone_task_milestone_2.setPredecessorValueList([x for x in project.project_milestone_task_milestone_2.getPredecessorValueList() if x != task])
self.tic()
self.assertEqual(task.getSourceMilestoneValue(), None)
self.assertEqual(len(project.project_milestone_task_milestone_2.getPredecessorValueList()),task_milestone_2_length)
self.assertTrue(task not in project.project_milestone_task_milestone_2.getPredecessorValueList())
project.project_milestone_task_milestone_2.setPredecessorValueList(project.project_milestone_task_milestone_2.getPredecessorValueList() + [task])
self.tic()
self.assertEqual(task.getSourceMilestoneValue(), project.project_milestone_task_milestone_2)
self.assertEqual(len(project.project_milestone_task_milestone_2.getPredecessorValueList()),task_milestone_2_length + 1)
self.assertTrue(task in project.project_milestone_task_milestone_2.getPredecessorValueList())
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>creation_guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>milestone_interaction_workflow</string> </value>
</item>
<item>
<key> <string>manager_bypass</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Milestone Interaction Workflow</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interactions</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<list>
<string>ProjectMilestone_updateTask</string>
</list>
</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>update_source_milestone_related_task</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setPredecessor.*</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Project Milestone</string>
</list>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Scripts" module="Products.DCWorkflow.Scripts"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>scripts</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
milestone= state_change['object']
old_task_list = milestone.getSourceMilestoneRelatedValueList(portal_type='Task')
new_task_list = milestone.getPredecessorValueList(portal_type='Task')
for task in old_task_list:
if task not in new_task_list and task.getSourceMilestoneValue() == milestone:
task.setSourceMilestoneValue(None)
for task in new_task_list:
if task not in old_task_list and task.getSourceMilestoneValue() != milestone:
task.setSourceMilestoneValue(milestone)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ProjectMilestone_updateTask</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Variables" module="Products.DCWorkflow.Variables"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>variables</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Worklists" module="Products.DCWorkflow.Worklists"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>worklists</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Project Line | edit_workflow Project Line | edit_workflow
Project Milestone | edit_workflow
Project Milestone | milestone_interaction_workflow
Project | edit_workflow Project | edit_workflow
Project | project_workflow Project | project_workflow
Requirement Document | edit_workflow Requirement Document | edit_workflow
......
milestone_interaction_workflow
project_workflow project_workflow
requirement_analysis_workflow requirement_analysis_workflow
task_interaction_workflow task_interaction_workflow
......
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