This question has been flagged
2 Replies
2225 Views

Hello

someone can tell me how to make a button to download the current document ? the current document is a document which is saved in the datatbase

Avatar
Discard
Best Answer
Avatar
Discard
Best Answer

you have to add this code to your XML code 

<button name="summary_print" type="object" string="Print" class="oe_highlight"/> ou <button name="cancel" string="Annuler" special="cancel" class="oe_link"/>

ans this to code python

def summary_print( self, cr, uid, ids, context = None ):
        stats_obj = self.pool.get( 'class.name' )
            
        datas = {
            'ids': ids,
            'model': 'class.name',
            'context': context,
        }

        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'report.name',
            'context': context,
            'datas': datas,
            'nodestroy' : True
        }

Avatar
Discard
Author

Thanx Hajar for ur answer but i want to download a document which is saves in the database, not a report ??