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

I am working in an invoice form in Odoo, what i want is to display all the related details of a customer selected in the form from database.I have given an onchange context in the xml

field string="Student" name="partner_id"
                           on_change=" _get_joined_student_data(partner_id)" context="{'default_branch':branch,'default_course':course,'default_faculty':faculty,'search_default_customer':1, 'show_address': 1,'special_display_name': True,'default_time_slot':time_slot}"
                            options='{"always_reload": True}'
                            domain="[('customer', '=', True)]"/>

And the corresponding function definition for the function is given below

 def _get_joined_student_data(self,partner_id):
    print "function"
    datas={}
    print self
    if partner_id:
        print partner_id
        self._cr.execute("SELECT c.id,c.fee,b.id,t.id,f.id FROM custom_joinform cj LEFT JOIN course_custom c on cj.course=c.id "+
           "LEFT JOIN branch_custom b on cj.branch=b.id LEFT JOIN custom_timeslot t on cj.time_slot=t.id LEFT JOIN custom_faculty f on cj.faculty=f.id LEFT JOIN res_partner r on r.id=cj.name where r.id="+str(partner_id)+" and function='Student'")
           #print "SELECT c.name,c.fee,b.name,t.name,f.name FROM custom_joinform cj LEFT JOIN course_custom c on cj.course=c.id LEFT JOIN branch_custom b on cj.branch=b.id LEFT JOIN custom_timeslot t on cj.time_slot=t.id LEFT JOIN custom_faculty f on cj.faculty=f.id LEFT JOIN res_partner r on r.id=cj.name where r.id="+str(self.name.id)+" and function='Student'"
        for res in self.env.cr.fetchall():
            datas={
                   'course':res[0],
                   'course_fee':res[1],
                   'branch':res[2],
                   'time_slot':res[3],
                   'faculty':res[4]
                  }
        print datas
        self.update(datas)


And the print statements inside the function is printing correctly. But nothing happens in the form after changing the selection.Can anyone help me to solve this issue.

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

I have tried with the below code but that too gives me the same output, Nothing happens for the fields which i have given in the xml for default values

아바타
취소
관련 게시물 답글 화면 활동
2
10월 17
5659
0
3월 23
1256
1
12월 20
5406
2
11월 19
4450
0
3월 19
2828