I have this code for name_get but I am getting the error:
in name_get TypeError: descriptor 'format' requires a 'str' object but received a 'bool'
I think I am not doing the name_get function right. Can you please help?
This is the code:
========================================================================
def name_get(self, cursor, uid, ids, context=None):
res = []
for nget in self.browse(cursor, uid, ids):
name = [str.format(nget.name), str.format(nget.batch_course_name), str.format(nget.batch_teacher), str.format(nget.batch_start_date), str.format(nget.batch_start_time), str.format(nget.batch_end_time)]
res.append((nget.id, ", ".join(name)))
return res
_name = 'intrac.batches'
_columns = {
'name': fields.char('Batch Number', readonly=True),
'batch_course_name': fields.many2one('intrac.courses', 'Course', required=True),
'batch_course_category': fields.char('Course Category', required=True),
'batch_start_date': fields.date('Start Date', required=True),
'batch_end_date': fields.date('End Date', required=True),
'batch_duration': fields.integer('Batch Duration (Hours)', required=True),
'batch_hours_per_day': fields.integer('Hours Per Day', required=True),
'batch_teacher': fields.many2one('intrac.teachers', 'Teacher', required=True),
'batch_start_time': fields.selection([('07:00 AM','07:00 AM'),('08:45 PM','08:45 PM')], 'Start Time', required=True),
'batch_end_time': fields.selection([('07:00 AM','07:00 AM'),('07:15 AM','07:15 AM')], 'End Time', required=True),
'batch_classroom': fields.many2one('intrac.classrooms', 'Classroom', required=True),
'classroom_capacity': fields.integer('Classroom Capacity', required=True),
'batch_registrations': fields.one2many('intrac.batches.registrations', 'batch_number', 'Registrations'),
'batch_att_sheets': fields.one2many('intrac.att.sheet', 'batch_number', 'Daily Attendance Sheets'),
'batch_attendance' : fields.one2many('intrac.attend', 'batch_number', 'Batch Attendance'),
'batch_notes': fields.one2many('intrac.batches.notes', 'batch_number', 'Notes'),
}