Commit 76ce5e7f authored by Mame Coumba Sall's avatar Mame Coumba Sall

Apply suggestions by Jerome

parent e7594cc5
......@@ -73,7 +73,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ProjectModule_closeRelatedAssigmentListDialog</string> </value>
<value> <string>string:${object_url}/ProjectModule_viewCloseRelatedAssigmentListDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>6.5</float> </value>
<value> <float>13.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -75,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ClosedProject_closeRelatedAssigmentsDialog</string> </value>
<value> <string>string:${object_url}/Project_viewCloseRelatedAssigmentListDialog</string> </value>
</item>
</dictionary>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>all_columns</string>
<string>columns</string>
<string>editable_columns</string>
<string>list_method</string>
<string>portal_types</string>
<string>report_root_list</string>
<string>report_tree</string>
<string>select</string>
<string>selection_name</string>
<string>sort_columns</string>
<string>stat_method</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>Base_viewSearchResultList</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>all_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>all_editable_columns</string> </key>
<value>
<list>
<tuple>
<string>int_index</string>
<string>Index</string>
</tuple>
<tuple>
<string>quantity</string>
<string>Estimated Time</string>
</tuple>
<tuple>
<string>start_date</string>
<string>Begin</string>
</tuple>
<tuple>
<string>stop_date</string>
<string>End</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
<string>destination_project_title</string>
<string>Project</string>
</tuple>
<tuple>
<string>parent_title</string>
<string>Assignee</string>
</tuple>
<tuple>
<string>destination_title</string>
<string>Organisation</string>
</tuple>
<tuple>
<string>site_translated_title</string>
<string>Site</string>
</tuple>
<tuple>
<string>group_translated_title</string>
<string>Group</string>
</tuple>
<tuple>
<string>function_translated_title</string>
<string>Function</string>
</tuple>
<tuple>
<string>activity_translated_title</string>
<string>Activity</string>
</tuple>
<tuple>
<string>role_translated_title</string>
<string>Role</string>
</tuple>
<tuple>
<string>start_date</string>
<string>Start Date</string>
</tuple>
<tuple>
<string>stop_date</string>
<string>Stop Date</string>
</tuple>
<tuple>
<string>translated_validation_state_title</string>
<string>State</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>start_date</string>
<string>Begin Date</string>
</tuple>
<tuple>
<string>stop_date</string>
<string>End Date</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_listbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value>
<list>
<tuple>
<string>Assignment</string>
<string>Assignment</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>report_root_list</string> </key>
<value>
<list>
<tuple>
<string>project_project_domain</string>
<string>Project</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>report_tree</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>select</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>project_assignment_selection</string> </value>
</item>
<item>
<key> <string>separate_tree_data</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>stat_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Related Assignments</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>ProjectModule_getDestinationProjectRelatedAssignmentList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>portal_catalog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -52,36 +52,10 @@
<key> <string>_body</string> </key>
<value> <string>from Products.ZSQLCatalog.SQLCatalog import Query\n
closed_project_list = context.portal_catalog(portal_type=\'Project\', validation_state=\'invalidated\')\n
assignment_list = []\n
all_assignment_list = []\n
for project in closed_project_list:\n
destination_project_uid_list = [x.uid for x in context.portal_catalog(\n
relative_url=\'%s/%%\' % project.getRelativeUrl())] + [project.getUid()]\n
sql_kw = {}\n
if kw.has_key(\'from_date\') and kw[\'from_date\'] is not None:\n
query_kw = {\'delivery.start_date\' : kw[\'from_date\'],\n
\'range\' : \'min\'}\n
sql_kw[\'delivery.start_date\'] = Query(**query_kw)\n
if kw.has_key(\'at_date\') and kw[\'at_date\'] is not None:\n
query_kw = {\'delivery.stop_date\' : kw[\'at_date\'],\n
\'range\' : \'ngt\'}\n
sql_kw[\'delivery.stop_date\'] = Query(**query_kw)\n
assignment_list.extend([x.getObject() for x in \\\n
context.portal_catalog(\n
portal_type=\'Assignment\',\n
destination_project_uid = destination_project_uid_list,\n
validation_state = \'open\',\n
**sql_kw)])\n
\n
\n
def sortAssignment(a, b):\n
result = cmp(a.getStartDate(), b.getStartDate())\n
if result == 0:\n
result = cmp(a.getTitle(), b.getTitle())\n
return result\n
\n
assignment_list.sort(sortAssignment)\n
\n
return assignment_list\n
all_assignment_list.extend(project.Project_getDestinationProjectRelatedAssignmentList(**kw))\n
return all_assignment_list\n
</string> </value>
</item>
<item>
......
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Project_closeRelatedAssignments</string> </value>
<value> <string>Project_closeRelatedAssignmentList</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -88,7 +88,10 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
<list>
<string>listbox_start_date</string>
<string>listbox_stop_date</string>
</list>
</value>
</item>
<item>
......@@ -108,7 +111,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ProjectModule_closeRelatedAssigmentListDialog</string> </value>
<value> <string>ProjectModule_viewCloseRelatedAssigmentListDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -116,7 +119,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>ClosedProject_closeRelatedAssigmentsDialog</string> </value>
<value> <string>ProjectModule_viewCloseRelatedAssigmentListDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -51,13 +51,18 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Message import translateString\n
from zExceptions import Unauthorized\n
portal = context.getPortalObject()\n
\n
message = translateString("Selected Assignments are now invalidated.")\n
for line in listbox:\n
if line.has_key(\'listbox_key\') and line[\'listbox_selected\'] is True:\n
assignment = portal.restrictedTraverse(line[\'listbox_key\'])\n
portal.portal_workflow.doActionFor(assignment, \'close_action\')\n
try:\n
portal.portal_workflow.doActionFor(assignment, \'close_action\')\n
except:\n
return context.Base_redirect(\'view\',\n
keep_items={\'portal_status_message\': "You are not allowed to close assignments"}, **kw)\n
\n
return context.Base_redirect(\'view\',\n
keep_items={\'portal_status_message\': message}, **kw)\n
......@@ -69,7 +74,7 @@ return context.Base_redirect(\'view\',\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Project_closeRelatedAssignments</string> </value>
<value> <string>Project_closeRelatedAssignmentList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -56,31 +56,22 @@
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
sql_kw = {}\n
if kw.has_key(\'from_date\') and kw[\'from_date\'] is not None:\n
if kw.get(\'from_date\') is not None:\n
query_kw = {\'delivery.start_date\' : kw[\'from_date\'],\n
\'range\' : \'min\'}\n
sql_kw[\'delivery.start_date\'] = Query(**query_kw)\n
if kw.has_key(\'at_date\') and kw[\'at_date\'] is not None:\n
if kw.get(\'at_date\') is not None:\n
query_kw = {\'delivery.stop_date\' : kw[\'at_date\'],\n
\'range\' : \'ngt\'}\n
sql_kw[\'delivery.stop_date\'] = Query(**query_kw)\n
assignment_list = ([x.getObject() for x in \\\n
context.portal_catalog(selection=selection, selection_report=selection_report, \n
portal_type=\'Assignment\',\n
destination_project_uid = destination_project_uid_list,\n
default_destination_project_uid = destination_project_uid_list,\n
validation_state = \'open\',\n
**sql_kw)])\n
\n
\n
def sortAssignment(a, b):\n
result = cmp(a.getStartDate(), b.getStartDate())\n
if result == 0:\n
result = cmp(a.getTitle(), b.getTitle())\n
return result\n
\n
assignment_list.sort(sortAssignment)\n
\n
return assignment_list\n
return sorted(assignment_list, key=lambda assignment: (assignment.getParentValue().getTitle(), assignment.getStartDate()))\n
</string> </value>
</item>
<item>
......
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Project_closeRelatedAssignments</string> </value>
<value> <string>Project_closeRelatedAssignmentList</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -111,7 +111,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ClosedProject_closeRelatedAssigmentsDialog</string> </value>
<value> <string>Project_viewCloseRelatedAssigmentListDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -119,7 +119,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>ClosedProject_closeRelatedAssigmentsDialog</string> </value>
<value> <string>Project_viewCloseRelatedAssigmentListDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -149,11 +149,11 @@
</tuple>
<tuple>
<string>start_date</string>
<string>Start Date</string>
<string>Begin Date</string>
</tuple>
<tuple>
<string>stop_date</string>
<string>Stop Date</string>
<string>End Date</string>
</tuple>
<tuple>
<string>translated_validation_state_title</string>
......
......@@ -81,7 +81,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>TaskReport_viewFieldLibrary</string> </value>
<value> <string>Base_viewProjectFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
......@@ -81,7 +81,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>TaskReport_viewFieldLibrary</string> </value>
<value> <string>Base_viewProjectFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
838
\ No newline at end of file
839
\ 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