From 305e8366553ac72fc6c1c642737b4817be1976be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Fri, 28 Mar 2008 17:43:01 +0000 Subject: [PATCH] PaySheetTransaction_getYearToDateWorkTimeSalary: if we cannot find a line with reference, try with ID, because this work_time_annotation_line will be created by accessor git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20201 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...eetTransaction_getYearToDateWorkTimeSalary.xml | 15 +++++++++++++++ bt5/erp5_payroll/bt/revision | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateWorkTimeSalary.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateWorkTimeSalary.xml index a595bafe0e..f2e34fa5d2 100644 --- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateWorkTimeSalary.xml +++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateWorkTimeSalary.xml @@ -76,6 +76,7 @@ search_params = \\\n \'portal_type\' : \'Pay Sheet Transaction\',\n \'delivery.start_date\' : {\'range\': "minmax", \'query\': (from_date, to_date)},\n \'delivery.source_section_uid\' : context.getSourceSectionUid(),\n + \'delivery.destination_section_uid\' : context.getDestinationSectionUid(),\n \'simulation_state\' : [\'confirmed\', \'stopped\', \'delivered\'],\n }\n \n @@ -85,6 +86,11 @@ yearly_work_time = 0\n for paysheet in paysheet_list:\n annotation_line = paysheet.getAnnotationLineFromReference(\\\n reference=\'work_time_annotation_line\')\n + if annotation_line is None:\n + annotation_line = getattr(paysheet, \'work_time_annotation_line\', None)\n + if annotation_line is None:\n + raise ValueError, "Paysheet %s has no Annotation Line with reference work_time_annotation_line"\\\n + % paysheet.getRelativeUrl()\n nb_heures = annotation_line.getQuantity()\n yearly_work_time += nb_heures\n \n @@ -103,6 +109,12 @@ return yearly_work_time\n <none/> </value> </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> <item> <key> <string>_params</string> </key> <value> <string></string> </value> @@ -145,6 +157,9 @@ return yearly_work_time\n <string>_getiter_</string> <string>paysheet</string> <string>annotation_line</string> + <string>None</string> + <string>getattr</string> + <string>ValueError</string> <string>nb_heures</string> <string>_inplacevar_</string> </tuple> diff --git a/bt5/erp5_payroll/bt/revision b/bt5/erp5_payroll/bt/revision index 7df2addf7b..f937f7e2b3 100644 --- a/bt5/erp5_payroll/bt/revision +++ b/bt5/erp5_payroll/bt/revision @@ -1 +1 @@ -232 \ No newline at end of file +233 \ No newline at end of file -- GitLab