diff --git a/openeducat_erp/op_admission/op_admission.py b/openeducat_erp/op_admission/op_admission.py index 75be807e8..c7a2b673b 100644 --- a/openeducat_erp/op_admission/op_admission.py +++ b/openeducat_erp/op_admission/op_admission.py @@ -102,34 +102,33 @@ def confirm_in_progress(self): @api.one def confirm_selection(self): - for admission in self: - gr = admission.gr_no_new - if admission.gr_no == True: - gr = admission.gr_no_old - vals = { - 'title': admission.title and admission.title.id or False, - 'name': admission.name, - 'middle_name': admission.middle_name, - 'last_name': admission.last_name, - 'birth_date': admission.birth_date, - 'gender': admission.gender, - 'category': admission.category_id and admission.category_id.id or False, - 'course_id': admission.course_id and admission.course_id.id or False, - 'batch_id': admission.batch_id and admission.batch_id.id or False, - 'standard_id': admission.standard_id and admission.standard_id.id or False, - 'religion': admission.religion_id and admission.religion_id.id or False, - 'photo': admission.photo or False, - 'gr_no': gr, - 'title': admission.title and admission.title.id or False, - 'street': admission.street or False, - 'street2': admission.street2 or False, - 'phone': admission.phone or False, - 'mobile': admission.mobile or False, - 'zip': admission.zip or False, - 'city': admission.city or False, - 'country_id': admission.country_id and admission.country_id.id or False, - 'state_id': admission.state_id and admission.state_id.id or False, - } + gr = self.gr_no_new + if self.gr_no == True: + gr = self.gr_no_old + vals = { + 'title': self.title and self.title.id or False, + 'name': self.name, + 'middle_name': self.middle_name, + 'last_name': self.last_name, + 'birth_date': self.birth_date, + 'gender': self.gender, + 'category': self.category_id and self.category_id.id or False, + 'course_id': self.course_id and self.course_id.id or False, + 'batch_id': self.batch_id and self.batch_id.id or False, + 'standard_id': self.standard_id and self.standard_id.id or False, + 'religion': self.religion_id and self.religion_id.id or False, + 'photo': self.photo or False, + 'gr_no': gr, + 'title': self.title and self.title.id or False, + 'street': self.street or False, + 'street2': self.street2 or False, + 'phone': self.phone or False, + 'mobile': self.mobile or False, + 'zip': self.zip or False, + 'city': self.city or False, + 'country_id': self.country_id and self.country_id.id or False, + 'state_id': self.state_id and self.state_id.id or False, + } self.write( {'state': 's', 'student_id': self.env['op.student'].create(vals).id, 'nbr': 1}) return True diff --git a/openeducat_erp/op_allocat_division/op_allocat_division.py b/openeducat_erp/op_allocat_division/op_allocat_division.py index 5c014731f..8ba043bd7 100644 --- a/openeducat_erp/op_allocat_division/op_allocat_division.py +++ b/openeducat_erp/op_allocat_division/op_allocat_division.py @@ -33,9 +33,8 @@ class op_allocat_division(models.Model): @api.one def generate_division(self): - for allocation in self: - allocation.student_ids.write( - {'division_id': allocation.division_id.id}) + self.student_ids.write( + {'division_id': self.division_id.id}) return True # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/openeducat_erp/op_attendance_sheet/op_attendance_sheet.py b/openeducat_erp/op_attendance_sheet/op_attendance_sheet.py index f3e2f5220..c8a30d69f 100644 --- a/openeducat_erp/op_attendance_sheet/op_attendance_sheet.py +++ b/openeducat_erp/op_attendance_sheet/op_attendance_sheet.py @@ -25,17 +25,17 @@ class op_attendance_sheet(models.Model): _name = 'op.attendance.sheet' + @api.one @api.depends('attendance_line.present') def _total_present(self): - for sheet in self: - self.total_present = len(sheet.attendance_line.filtered( - lambda self: self.present)) + self.total_present = len(self.attendance_line.filtered( + lambda self: self.present)) + @api.one @api.depends('attendance_line.present') def _total_absent(self): - for sheet in self: - self.total_absent = len(sheet.attendance_line.filtered( - lambda self: self.present == False)) + self.total_absent = len(self.attendance_line.filtered( + lambda self: self.present == False)) name = fields.Char('Name', size=8) register_id = fields.Many2one( @@ -45,9 +45,9 @@ def _total_absent(self): attendance_line = fields.One2many( 'op.attendance.line', 'attendance_id', 'Attendance Line', required=True) total_present = fields.Integer( - 'Total Present', compute='_total_present', method=True) + 'Total Present', compute='_total_present') total_absent = fields.Integer( - 'Total Absent', compute='_total_absent', method=True) + 'Total Absent', compute='_total_absent') teacher_id = fields.Many2one('op.faculty', 'Teacher') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/openeducat_erp/op_book_movement/op_book_movement.py b/openeducat_erp/op_book_movement/op_book_movement.py index 543840233..f847a4583 100644 --- a/openeducat_erp/op_book_movement/op_book_movement.py +++ b/openeducat_erp/op_book_movement/op_book_movement.py @@ -35,7 +35,7 @@ class op_book_movement(models.Model): _rec_name = 'book_id' book_id = fields.Many2one('op.book', 'Book', required=True) - quantity = fields.Integer('No. Of Books', size=256, required=True) + quantity = fields.Integer('No. Of Books', required=True) type = fields.Selection( [('student', 'Student'), ('faculty', 'Faculty')], 'Student/Faculty', required=True) student_id = fields.Many2one('op.student', 'Student')