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

Getting not found error for downloading document while logged in "PUBLIC user" in website sale. 

in my controller:

attachments = request.env['ir.attachment'].sudo().search(  [('res_id', '=', order.id)])

in my  xml

 <t t-foreach="attachments" t-as="attachment">

  <a target="_blank" t-attf-href="/web/content/#{attachment.id}?download=1" t-esc="attachment.datas_fname" class="fa fa-download"/>

I can able to download in users, but i'm getting not found err in public user

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Annadurai, 

Public users don't have permission to access orders. 

Kindly try to replace controller line with the following:

attachments = request.env ['ir.attachment']. sudo (). search ([('res_id', '=', order.sudo (). id)])

If you still have any issue then please share the logs. 

Thanks

Anisha Bahukhandi

Technical Content Writer

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 17
6157
0
พ.ค. 23
1963
3
พ.ค. 15
13891
0
ส.ค. 23
2491
0
พ.ค. 23
2455