Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
6407 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
2
ago. 17
6103
0
mai. 23
1931
3
mai. 15
13816
0
ago. 23
2456
0
mai. 23
2419