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

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
srp 17
5944
0
kvě 23
1839
3
kvě 15
13680
0
srp 23
2306
0
kvě 23
2303