00001 ############################################################################## 00002 # 00003 # Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. 00004 # Fabien Pinckaers <fp@tiny.Be> 00005 # Copyright (c) 2007-2008 Albert Cervera i Areny <albert@nan-tic.com> 00006 # 00007 # WARNING: This program as such is intended to be used by professional 00008 # programmers who take the whole responsability of assessing all potential 00009 # consequences resulting from its eventual inadequacies and bugs 00010 # End users who are looking for a ready-to-use solution with commercial 00011 # garantees and support are strongly adviced to contract a Free Software 00012 # Service Company 00013 # 00014 # This program is Free Software; you can redistribute it and/or 00015 # modify it under the terms of the GNU General Public License 00016 # as published by the Free Software Foundation; either version 2 00017 # of the License, or (at your option) any later version. 00018 # 00019 # This program is distributed in the hope that it will be useful, 00020 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 # GNU General Public License for more details. 00023 # 00024 # You should have received a copy of the GNU General Public License 00025 # along with this program; if not, write to the Free Software 00026 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00027 # 00028 ############################################################################## 00029 00030 from Koo.Common import Api 00031 from Koo.Common import Common 00032 from Koo.Plugins import Plugins 00033 00034 ## @brief Executes the workflow graph report 'workflow.instance.graph' 00035 # including subworkflows. 00036 def printWorkflow(model, id, ids, context): 00037 # Plugins might be called with no record selected but that doesn't 00038 # make sense for this plugin so simply return. 00039 if not id: 00040 return 00041 Api.instance.executeReport('workflow.instance.graph', { 00042 'id' : id, 00043 'ids' : ids, 00044 'model' : model, 00045 'nested' : True, 00046 }, context=context) 00047 00048 ## @brief Executes the workflow graph report 'workflow.instance.graph' without 00049 # subworkflows. 00050 def printSimpleWorkflow(model, id, ids, context): 00051 # Plugins might be called with no record selected but that doesn't 00052 # make sense for this plugin so simply return. 00053 if not id: 00054 return 00055 Api.instance.executeReport('workflow.instance.graph', { 00056 'id' : id, 00057 'ids' : ids, 00058 'model' : model, 00059 'nested' : False, 00060 }, context=context) 00061 00062 Plugins.register( 'SimpleWorkflowPrinter', '.*', _('Print Workflow'), printSimpleWorkflow ) 00063 Plugins.register( 'WorkflowPrinter', '.*', _('Print Workflow (Complex)'), printWorkflow )