On 06/08/11 15:51 -0700, oscar_andres_col wrote:
> Hi,
> 
> 
> I am working in a module triying release a FileChooserDialog for open
> a file:
> 
> In xml file the module I have:
> 
>                form:
>                         <field name="id_pass"/>
>                         <label name="start_contract"/>
>                         <field name="start_contract"/>
>                         <label name="section"/>
>                         <field name="section"/>
>                         <button string="Photo"
>                             type="object"
>                             name="_get_image"
>                             icon="tryton-go-next"/>
> 
> I create a button for call method _get_image and work it.
> 
> In the model I have:
> 
> from tryton.common import file_selection
> 
> class MyModel(ModelSQL, ModelView):
> . . .
>     def _get_image(self, ids):
>         response = file_selection("Selecting Image", '', parent=None)
>         return {}
> 
> . . .
> MyModel()
> 
> but this fail, because to generate the next ExceptionError.
> parent.present(),   "Parent don't have attribute the
> 'present'" (related with common.common) line 325.
> I know that must to exist 'parent', but how I get parent window main
> instance (from tryton client), for to pass to "file_selection" method
> or exit other way for Call FileChooserDialog.

You can not import client code in server code.
You just have to use a Binary fields like on attachment.

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

Reply via email to