On 31/07/13 13:03 -0700, Demoy Blake wrote:
> I created a python script that uses proteus to generate patient records then 
> returns the id of that patient (map_Mdata() below).
> I want to create a tryton wizard which would executes this script then change 
> to the form view of the newly created patient, however tryton wizard 
> documention is quite lacking (providing only an example with no comments, 
> explanation , etc).
> 
> This wizard was based on the "openappointmentreport" from gnuhealth but i 
> been unsuccessful at executing the external script map_Mdata() in do_open
> 
> 
> class aa(Wizard):
>     'Import Patient Record'
>     __name__='aa'
>     start = StateView('aas',
>             'aa.aaForm', [
>             Button('Cancel', 'end', 'tryton-cancel'),
>             Button('Open', 'open_', 'tryton-ok', default=True),
>             ])
>     open_ = StateAction('health.action_gnuhealth_patient_view')
>     
> 
>     def do_open_(self, action):
>         action['pyson_context'] = PYSONEncoder().encode({
>                 'patient': map_Mdata(self.start.uid),
>                 })
> 
>         return action, {}
> 
>     def transition_open_(self):
>         return 'end'
> 
> Script should be executed after start button is pressed, advice is greatly 
> appreciated

That's not a great idea to run a proteus script inside a wizard.
From inside a wizard you should directly used the Model's.
In your example, the code must be added in the method
"transition_open_".

-- 
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: pgpR3ZFpLE3tm.pgp
Description: PGP signature

Reply via email to