On 17/07/13 13:42 -0700, Demoy Blake wrote:
> I have created two classes (shown below) along with the necessary views
> but when I open the views associated with class AppointmentSchedule the
> day selection-field from class AppointmentHours is not shown in
> active_hours many2one field hour_start and hour_end field display
> correctly.
>
> class AppointmentHours(ModelSQL, ModelView):
> 'Appointment Hours'
> __name__ = 'gnuhealth.appointment.hours'
> day = fields.Selection([('monday','Monday'),('tuesday','Tuesday'),
> ('wednesday','Wednesday'),('thursday','Thursday'),('friday','Friday'),
> ('saturday','Saturday'),('sunday','Sunday')],'Day of the Week',
> required=True, select=True)
> hour_start = fields.Time('Hour Start')
> hour_end = fields.Time('Hour End')
>
>
>
> class AppointmentSchedule(ModelSQL, ModelView):
> 'Appointment Schedule'
> __name__ = 'gnuhealth.appointment.schedule'
>
> physician =
> fields.Many2One('gnuhealth.physician','Physician',required=True)
>
> active_hours= fields.One2Many('gnuhealth.appointment.hours','day',
> 'Working Hours')
The field for One2Many (here you wrongly used 'day') must be the name of
the Many2One field on the target ('gnuhealth.appointment.hours') that
points to the origin model ('gnuhealth.appointment.schedule')
See
http://doc.tryton.org/2.8/trytond/doc/ref/models/fields.html?highlight=one2many#trytond.model.fields.One2Many
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/
pgpG13Mr4FMLz.pgp
Description: PGP signature
