From 4eb3ddb823b244ffcc6fdc50a4c3a34f8e7b15e7 Mon Sep 17 00:00:00 2001 From: Mehul0812 Date: Thu, 14 Nov 2024 18:01:59 +0530 Subject: [PATCH] [18.0][FIX]fixed validation in core --- openeducat_core/models/student.py | 4 ++-- openeducat_core/models/subject_registration.py | 2 +- openeducat_core/views/student_course_view.xml | 2 +- openeducat_core/views/student_view.xml | 8 ++++---- openeducat_core/views/subject_registration_view.xml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openeducat_core/models/student.py b/openeducat_core/models/student.py index fc0beeefb..e6f4c00ff 100644 --- a/openeducat_core/models/student.py +++ b/openeducat_core/models/student.py @@ -32,7 +32,7 @@ class OpStudentCourse(models.Model): student_id = fields.Many2one('op.student', 'Student', ondelete="cascade", tracking=True) course_id = fields.Many2one('op.course', 'Course', required=True, tracking=True) - batch_id = fields.Many2one('op.batch', 'Batch', required=True, tracking=True) + batch_id = fields.Many2one('op.batch', 'Batch', tracking=True) roll_number = fields.Char('Roll Number', tracking=True) subject_ids = fields.Many2many('op.subject', string='Subjects') academic_years_id = fields.Many2one('op.academic.year', 'Academic Year') @@ -119,7 +119,7 @@ def _onchange_name(self): @api.constrains('birth_date') def _check_birthdate(self): for record in self: - if record.birth_date > fields.Date.today(): + if record.birth_date and record.birth_date > fields.Date.today(): raise ValidationError(_( "Birth Date can't be greater than current date!")) diff --git a/openeducat_core/models/subject_registration.py b/openeducat_core/models/subject_registration.py index f2f72f733..17ed4cc1e 100644 --- a/openeducat_core/models/subject_registration.py +++ b/openeducat_core/models/subject_registration.py @@ -33,7 +33,7 @@ class OpSubjectRegistration(models.Model): tracking=True) course_id = fields.Many2one('op.course', 'Course', required=True, tracking=True) - batch_id = fields.Many2one('op.batch', 'Batch', required=True, + batch_id = fields.Many2one('op.batch', 'Batch', tracking=True) compulsory_subject_ids = fields.Many2many( 'op.subject', 'subject_compulsory_rel', diff --git a/openeducat_core/views/student_course_view.xml b/openeducat_core/views/student_course_view.xml index 50856dafe..6b3e02483 100644 --- a/openeducat_core/views/student_course_view.xml +++ b/openeducat_core/views/student_course_view.xml @@ -32,7 +32,7 @@ - + diff --git a/openeducat_core/views/student_view.xml b/openeducat_core/views/student_view.xml index 1219c78cb..03fa53e61 100644 --- a/openeducat_core/views/student_view.xml +++ b/openeducat_core/views/student_view.xml @@ -114,7 +114,7 @@ - + @@ -127,7 +127,7 @@ - +