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

Hey guys , 

this my first fields selections : 

'niveau_kid' : fields.selection([('a', 'Twist and Shout'), ('b', 'Starter Kid'), ('c', 'Sky 1'), ('d', 'Sky 2'), ('e', 'Sky 3'), ('f', 'Upper-intermediate Kid'), ('g', 'Advanced Kid')]),

'grp_kid': fields.selection([('mer1', 'Mercredi 14h - 16h'), ('mer2', 'Mercredi 16h - 18h'), ('ven', 'Vendredi 17h - 19h')], 'Groupe', compute='_return_group_kid'),

and i want that the grp_kid fields depend to niveau_kid 

for exemple :

        if a is selected , then we can choose in the second field between only two values (mer1 and mer2)  

        if g is selected then we will have only one choice (ven) 

         ........ 

------------------------------ i tried this code but it don't work ----------

#@api.one

@api.onchange('niveau_kid')

def _return_group_kid(self):

     if not self.niveau_kid:

         return

     if self.niveau_kid == 'f':

         self.grp_kid.selection = [ ('a', 'Mercredi 14h - 16h'), ]

    if self.niveau_kid == 'g':

        self.grp_kid.selection = [ ('b', 'Mercredi 16h - 18h'), ]

    else:

self.grp_kid.selection = [ ('a', 'Mercredi 14h - 16h'), ('b', 'Mercredi 16h - 18h'), ('c', 'Vendredi 17h - 19h'), ]

아바타
취소
관련 게시물 답글 화면 활동
1
5월 21
4003
4
10월 19
9760
1
1월 18
9145
1
2월 17
5093
0
12월 16
2965