콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
1950 화면

I have a model that have fields binary


file_pdf = fields.Binary(string="File PDF")


I can upload my PDF. But I cannot download back the file. I'm planning to process the binary in the backend so the user will be receive the processed PDF.


I tried what you suggest. here is the result



1 is for Milly shajan

2 is for  Dương Nguyễn

Sorry I have to reply from the question since I cannot put image in the reply



아바타
취소

Hello, i check the source code and see that if you apply my code on transient model (wizard) you can not have option download because transient model data will be deleted automatically. So i think if you need to download this attachment, write a logic to update it into message_attachment_ids of the model that trigger this wizard

작성자

that make sense. Please update your answer or make new answer. I will mark it as the best answer

Wow, thanks, i have updated the answers cheer sir

베스트 답변

Hello, i check the source code and see that if you apply the binary field on xml for transient model (wizard) you can not have option download because transient model data will be deleted automatically. So i think if you need to download this attachment, write a logic to update it into message_attachment_ids of the model that trigger this wizard

The condition at https://github.com/odoo/odoo/blob/07636eae3c36e6b118af3d8386672278be52cf46/addons/web/static/src/views/fields/binary/binary_field.xml#L13-L18 failed and therefor no download button is display



아바타
취소
작성자

not working. The element still like text input. If I click it, it ask for the new file upload. Not downlaoding existing file

really, i copy same in ir.attachment form view. Odds

Did you get it like the image i have posted above?

작성자

No. What I got is like in the question. Please see my question again. I add image of what it looks like after I try add it

베스트 답변

Hello 

add one Char Field for that filename as 

filename = fields.Char(string='Name')

and in the XML View update the view as follows


Regards

아바타
취소
작성자

still cannot download the binary field. No download button. Please see my question again. I add image and what I write in the xml

관련 게시물 답글 화면 활동
3
8월 24
1894
7
6월 20
20790
1
8월 25
404
1
5월 25
1246
0
11월 24
1379