Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
6330 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
aug. 17
5997
0
mei 23
1863
3
mei 15
13704
0
aug. 23
2351
0
mei 23
2353