Am 22.03.2012 20:02, schrieb Albert Cervera i Areny:

A Dijous, 22 de marē de 2012 19:39:34, Cédric Krier va escriure:

> On 22/03/12 19:30 +0100, Jan Grasnick | grasbauer ug wrote:

> > if a workflow changes to a next state, the states (required,

> > invisible) of some fields are changing depending of the state,

> > defined in pyson-domains. It would be helpful, if the workflow

> > engine is checking this further states on writing and setting the

> > fields to required on the fly. We have implemented some workaround

> > in the write-method of the models, but I think there should be a

> > pre-evaluation of the required fields in the next state of the

> > workflow.

>

> I don't understand with a required states this is already possible and

> managed.

I think that what he says is: given that you already define all possible workflow transitions (using self._transitions), the system should automatically define the "states" attributes for self._buttons.




Short example:

Sale > Transition form 'draft'  to 'quotation'

SaleLine > field.XXX with states = {required: Not(Equal(Get(Eval('_parent_sale', {}), 'state'), 'draft'))}

in this case you can do the transition of the Sale without a warning, that the field.XXX of SaleLine is required in case Sale has another state than 'draft'

Its a little bit hard to explain: I know, that the pyson domain says clearly: the field.XXX is required if the state of Sale is in all other states than 'draft'. So the field.XXX is required after the transition. But it would be nice to have a possibility to pre-evaluate the values of some fields meanwhile the transition. We have this use-cases very often if a document stays a long time in a particular state and people is collecting informations to transform it to the next state. So we have implemented a solution with a workaround - if there are missing fields, we are doing the pre-evaluation in write() depending of the presence of the key 'state' and his value.

While writing this, I'm not sure if it is a question of our current design ;) . We can implement another state called 'i_feel_like_mostly_everything_is_done_well_in_the_document', after transition to this state the pyson statements of the fields are evaluated to this and the next transition results in a well formed document.
<http://www.dict.cc/englisch-deutsch/I%27m+not+sure.html>

--
[email protected] mailing list

Reply via email to