I have doctor and team and doctorteam, every doctor can belong to many 
teams and teams can have many doctors

They are defined like this (removed/edited things for brevity/clarity):


class Team(ModelSQL, ModelView):
    'Etc'
    __name__ = 'team'

    doctors = fields.Many2Many('team_doctor', 'team', 'doctor', 'Doctors' )


class TeamDoctor(ModelSQL, ModelView):
    'etc'
    __name__ = 'team_doctor'

    team = fields.Many2One('team','Team', required=True)
    doctor = fields.Many2One('doctor', 'Doctor', required=True)
    
    def search(cls, name, clause):
        pass


class Doctor(ModelSQL, ModelView):
    'etc'
    __name__ = 'doctor' 
    teams = fields.One2Many('team_doctor', 'doctor', 'TEAMs')


this seems to work except when I try to access Doctor from any view I get 
the error when search is not defined in TeamDoctor
AttributeError: type object 'doctor_doctorgroup' has no attribute 'search'


I dont know how to define that method search, I always get
unbound method search() must be called with doctor_doctorgroup instance as 
first argument (got list instance instead()
no matter what

What I'm doing wrong?

Thanks!
Mariano

Reply via email to