Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5104 มุมมอง

i have create the xlsx file from openerp and i need to send to browser when i click button and make it as downloadable how can i achieve this

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Finally i found out the answer how to make a file as downloadable

insert the contents of the file in ir.attachment object and give return as attach_id = self.pool.get('ir.attachment').create(cr, uid, data_attach) return { 'type': 'ir.actions.act_url', 'url': "http://localhost:8080/openerp/attachment/get_data?record="+str(attach_id), 'nodestroy': True, 'target': 'new' }

data_attach = {'name':'filename.xlsx', 'datas':base64.encodestring(contents), 'datas_fname':'filename.xlsx', 'description':'description', 'res_id':current record id}

here attach_id is newly created record in ir.attachment and i have customised get method to get_data in web module we can use like this return { 'type': 'ir.actions.act_url', 'url': "http://localhost:8080/openerp/attachment/get?record="+str(attach_id),

อวตาร
ละทิ้ง

Hello Sir, Can you please provide me some guidelines as to how you customized the get method. Thanks..

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 23
1834
2
มี.ค. 15
7377
0
พ.ค. 23
66
2
ก.ย. 24
3311
1
ม.ค. 23
16547