Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2428 มุมมอง

The controller I wrote works on a common new web page ( website.test-add-fields), but when I adapt the code to use it in a page from an odoo model (website_hr_recruitment.apply_audition_result_form), it doesn't give any result (nor error...).


Here is my Python code:


class TestAddDropdownGood(http.Controller):

  @http.route('/audition-selection-result-form-94', auth='public', type='http', website='True')
def handler(self):

current_user = http\.request\.env\.context\.get\('uid'\)

\ \ \ \ \ \ \ \ students\ =\ request\.env\['x_students'\]\.sudo\(\)\.search\(\[\('id','!=',False\)\]\)

\ \ \ \ \ \ \ \ values\ =\ \{
\ \ \ \ \ \ \ \ \ \ \ \ 'students':\ students
\ \ \ \ \ \ \ \ \}
\ \ \ \ \ \ \ \ return\ request\.render\('website_hr_recruitment\.apply_audition_result_form',\ values\)


Here\ is\ my\ xml:

\ \ \ \ \ \ \ \ \ \ \ \

\ \ \ \ \ \ \ \ \ \ \ \

Can someone tell me the problem?


Thank you so much for your help!!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You are altering existing class, you need to inherit that class first. like here https://www.odoo.com/documentation/16.0/developer/reference/backend/http.html

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you Jacob, bit I am not sufficiently experienced to write the needed code...

Could you tell me more concretely what I have to add in my main.py file?

thank you for your help!

อวตาร
ละทิ้ง

did you manage to solve it?

ผู้เขียน

Someone else did it for me! Thank you for your help.

Related Posts ตอบกลับ มุมมอง กิจกรรม
How to get model object from Controller แก้ไขแล้ว
3
ก.ค. 20
12179
0
เม.ย. 20
3736
3
มิ.ย. 17
14127
0
มี.ค. 15
3780
1
พ.ค. 25
2080