On 16/05/11 20:29 -0700, Daniel Yang wrote:
> hi team,
> 
> I have a problem with making a form readonly according to workflow
> states.
> I tried to define a states attribute in form tag of the view xml file,
> but got an error( obviously form tag does not support "states"
> attribute ).
> and also tried the tag "notepage" and "page", no error alerted, but
> still did not work out.
> finally I put the states stuff in model,  something like:
> 
> code = fileds.Char('Code', size=60, states={'readonly':
> Equal(Eval('state'), 'done')})..
> 
> It works.
> 
> Is there any way to disable a form in view instead of in model?

No. States define the behavior of a Model than they must be defined on it, it
is like a constraint.
Putting states on View doesn't enforce the behavior of the Model to be the
same everywhere.
Also it is good pattern to separate the Model and the View.


PS: next time, this kind of question should go to tryton-dev
-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpp2zJvUaTso.pgp
Description: PGP signature

Reply via email to