Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6394 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 17
6082
0
thg 5 23
1923
3
thg 5 15
13795
0
thg 8 23
2451
0
thg 5 23
2418