From cb632afa3b79a28d3aab0eb7d08c78796efee6f6 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Wed, 28 Oct 2009 08:47:59 +0000
Subject: [PATCH] 2009-10-28 Seb * Make the report working even if stop dates
 are not defined everywhere

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30053 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_project/ProjectModule_generateMilestoneReport.xml   | 5 +++--
 bt5/erp5_project/bt/revision                                 | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/ProjectModule_generateMilestoneReport.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/ProjectModule_generateMilestoneReport.xml
index b722ad48eb..d0862316ec 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/ProjectModule_generateMilestoneReport.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/ProjectModule_generateMilestoneReport.xml
@@ -100,7 +100,7 @@ if len(project_uid_list):\n
   milestone_list = [x for x in portal.portal_catalog(parent_uid=project_uid_list,\n
                        portal_type=\'Project Milestone\', select_dict=select_dict, **sql_kw)]\n
                 \n
-milestone_list.sort(key = lambda x: (x.parent_title, x.stop_date, x.title))\n
+milestone_list.sort(key = lambda x: (x.parent_title, getattr(x, \'stop_date\', None), x.title))\n
 \n
 for milestone in milestone_list:\n
   # We wish to display the project only for the first milestone\n
@@ -109,7 +109,7 @@ for milestone in milestone_list:\n
   parent_title = milestone.parent_title\n
   line_kw[\'project_title\'] = milestone.parent_title\n
   line_kw[\'milestone_title\'] = milestone.title\n
-  line_kw[\'stop_date\'] = milestone.stop_date\n
+  line_kw[\'stop_date\'] = getattr(milestone, \'stop_date\', None)\n
   listbox.append(line_kw)\n
 \n
 context.Base_updateDialogForm(listbox=listbox, empty_line_number=0)\n
@@ -189,6 +189,7 @@ return context.ProjectModule_viewMilestoneReport()\n
                             <string>milestone</string>
                             <string>line_kw</string>
                             <string>parent_title</string>
+                            <string>getattr</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_project/bt/revision b/bt5/erp5_project/bt/revision
index 8e6862383d..6e1d38407b 100644
--- a/bt5/erp5_project/bt/revision
+++ b/bt5/erp5_project/bt/revision
@@ -1 +1 @@
-684
\ No newline at end of file
+687
\ No newline at end of file
-- 
2.30.9