On Friday, October 3, 2014 3:29:02 PM UTC-3, Cédric Krier wrote:
>
> On 03 Oct 10:41, Mariano Ramon wrote:
> >
> > 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 is doctor_doctorgroup ?
>
>
Im sorry, it's a previous edit that I later changed to make it clearer, but
didn't correct the error messages I got. It should say team_doctor.
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: [email protected] <javascript:>
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>