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

I using Odoo14,

I have a form for student course registration,which is the form is accesible from public (no login require).


When a user register on the form, I want to have an option, there are a button to print a pdf report from their filled data by themself.


So, how to create pdf report from website frontend?


please , any help, source or tutorial how to do that will be very thanks,


Thanks,

Tri Nanda

아바타
취소
작성자 베스트 답변

I solved this by using this code:

my controller code

@http.route('/create/course-registration', type="http", auth="public", website=True)
def create_course_registration(self, **kw):
my_other_code...
my_other_ocde...
student_course = request.env['aqur.student.course'].sudo().create(
{'student_id': student_id.id, 'course_id': kw['course_id'], 'course_category_id': kw['course_category_id'],
'requisition_schedule_id': requisition_schedule_id})
return request.render('aqur_core.student_registration_thanks', {'student_course': student_course})


and here is my website template view:









(sorry if  I  screenshot the code above,when I paste my code in this forum it always disapear when I submit answer.

But I got the other problem now, the user must do login to access the pdf,

Is there a way to access or download the pdf with public user that don't require to login?

Please, any help, source or tutorial how to do that will be very thanks,

Thanks,

Tri Nanda


아바타
취소
베스트 답변

Hi,
 I hope once the form is filled, you will be recording data in the backend model/table, define a report for that model, and from the website you can call/print that report.

For  printing  from  website,  see this  answer :   How to print/Download report from website ?


Thanks

아바타
취소
작성자

Hi @Niyas, thank you for the answer,
Yes Niyas, when the form is filled and submited, it will record the data in the backend table/module.

Thank you for the reference answer Niyas,
but Niyas Sory, am still confused in where should I do start to write the code, do you have reference how to do that from stratch Niyas?, or step by step on how to do that?

Thanks,
Tri Nanda

작성자

Hi @Niyas, I can print the report now from my backend, thank you very much for the tutorial Niyas. I also can print report now from a button that call python function using your tutorial here: # https://www.youtube.com/watch?v=Dc8GDj7ygsI&list=PLqRRLx0cl0hoJhjFWkFYowveq2Zn55dhM&index=67

Now I confuse, how to call the function from Odoo website frontend Niyas.
may you refer me a code, source or tutorial how to do that Niyas, please?
Thanks,
Tri Nanda

작성자

@Hi Niyas, I solved this problem now, thank you for your tutorial reference. But I got other problem now, my user must do a login to access the pdf,

is there a way how access the pdf from public user thah doesn't require to login?

Thanks,
Tri Nanda

관련 게시물 답글 화면 활동
2
2월 24
4484
1
4월 23
1407
1
8월 22
5835
7
1월 20
9390
2
5월 25
9089