[Erp5-dev] [Erp5-report] r20588 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplateItem/p...

Jérome Perrin jerome at nexedi.com
Mon May 19 13:27:05 CEST 2008


Le jeudi 17 avril 2008 à 11:19 +0200, Łukasz Nowak a écrit : 
> Hello,
> 
> (...)
> > > Would it be possible to have some kind of configuration, like
> > > 'default_accounting_workflow' somewhere or fetching possible state
> > > list based on object/portal type? I seen many commits, which was
> > > avoiding workflow id hardcoding after some requests, but right now
> > > this habit is coming back...
> > >
> > I think it has already been discussed on this list but no solutions
> > has been retained for  now.
> > For my case I will make a library specific to order so that if you
> > have to change the default workflow id to use yours, you will only
> > need to do it in the library.
> 
> Well - it is possible to fetch workflow based possible list in context
> of object associated with workflow. I was thinking about to write such
> script:
> 
> def Base_getPossibleStateList(state_name='simulation_state'):
>   workflow = context.Base_getWorkflowForState(state_name=state_name)
>   return workflow.getPossibleStateList()
> 
> It might need to be proxy to manager or even use external
> method. What do you think about such idea? They might use caching,
> etc.

I also think we need such a script. 
IMHO, parameters should be the state name and a list of portal types. I
made a patch. I don't know where to put this code, so for now it's a
monkey patch to WorkflowTool, that can be used like this:

python:
here.portal_workflow.getTranslatedStateTitleItemList('simulation_state',
here.getPortalAccountingTransactionTypeList())

better idea ?

> And BTW - same situation is in tests and system still.
> 
> Is it something wrong with invoking:
> 
> portal.doActionFor(object,'confirm_action')
> 
> instead (it might be found in tests, eg. testPackingList,
> stepSplitAndDeferPackingList):
> 
> portal.doActionFor(object,'confirm_action',workflow_id='workflow_name')

Not as far as I know. This parameter is only usefull if you have
multiple workflows with same transition name and only want to pass one
of them.

Jérome
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WorkflowTool_getTranslatedStateTitleItemList.diff
Type: text/x-patch
Size: 1441 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080519/78cc7926/attachment.bin>


More information about the Erp5-dev mailing list