Index: Order_validateData.xml =================================================================== --- Order_validateData.xml (revision 18850) +++ Order_validateData.xml (working copy) @@ -3,8 +3,11 @@ - - + + Products.PythonScripts.PythonScript + PythonScript + + @@ -70,23 +73,28 @@ # This script check that necessary data exists on Order\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n order = state_change[\'object\']\n +T_ = order.Base_translateString\n error_message = \'\'\n message_list = []\n \n if order.getSource() is None:\n - message_list.append(\'No Source\')\n + message_list.append(T_(\'No Source\'))\n if order.getStartDate() is None and order.getStopDate() is not None:\n order.setStartDate(order.getStopDate())\n if order.getStartDate() is None:\n - message_list.append("No Date")\n + message_list.append(T_("No Date"))\n if order.getDestination() is None:\n - message_list.append(\'No Destination\')\n -for line in order.objectValues(portal_type=order.getPortalOrderMovementTypeList()):\n - if line.getResourceValue() is None:\n - message_list.append("No Resource for line with id: %s" % line.getId())\n + message_list.append(T_(\'No Destination\'))\n +task_lines_list = order.objectValues(portal_type=order.getPortalOrderMovementTypeList())\n +if len(task_lines_list) > 0:\n + for line in task_lines_list:\n + if line.getResourceValue() is None:\n + message_list.append(T_("No Resource for line with id: %s") % line.getId())\n +else:\n + message_list.append(T_("No Resource"))\n \n if len(message_list) > 0:\n - raise ValidationFailed, "Warning: " + " --- ".join(message_list)\n + raise ValidationFailed, T_("Warning: ") + " --- ".join(message_list)\n ]]> @@ -137,13 +145,15 @@ ValidationFailed _getitem_ order + _getattr_ + T_ error_message message_list - _getattr_ None + task_lines_list + len _getiter_ line - len