Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
7680 Zobrazení

I made a custom web controller and I want to link to the action of that controller inside a view form to download a file. The only problem I am facing currently is to show the link in the view for the user to click, at this point I don't care if it looks like a button or a link anything or any help would be appreciated. Bellow is the code for the controller and the form inside of which I want the link/button to appear.

#controller class MyController(http.Controller): _cp_path = '/sc'

@http.httprequest
def some_html(self, req, s_action=None, **kw):
    return req.make_response(open('/home/ramywafa/openerpworkspace/imms_modules/imms_crew/controllers/templates/1.docx').read(),
           [('Content-Type', 'application/octet-stream; charset=binary'),
           ('Content-Disposition', content_disposition('1.docx', req))],
        )

#xml view

<record model="ir.ui.view" id="view_sefarer_applicant_form">
....
    <sheet>
       <div class="oe_right oe_button_box">
        <button name="action_open_agreement_form" type="object" string="P021 Employment Agreement" attrs="{'invisible':[('state','!=','pending')]}"/>
        <button name="action_open_agreement_form" type="object" string="P014 Drug/Alcohol Delcaration" attrs="{'invisible':[('state','!=','done')]}"/>#where I want the button/link
         ....
    </div>
    </sheet>
</div>
Avatar
Zrušit

You need to create a javascript to redirect on that controller. In java script you need to make json rpc call. You can make a new widget for that.

Autor

can the widget pass the id of the currently selected applicant to the custom controller as parameter, something like sc/some_html?id=#{applicant_id} ?

Related Posts Odpovědi Zobrazení Aktivita
0
bře 15
4255
1
lis 24
1590
1
zář 21
9367
12
pro 23
43881
1
led 24
16981