Skip to content

Commit

Permalink
Merge pull request #834 from mehul0812/18.0-mehul-core-issue
Browse files Browse the repository at this point in the history
[18.0][FIX] fixed validation in core
  • Loading branch information
parthivgls authored Nov 14, 2024
2 parents 52a333b + 4eb3ddb commit 60e69b1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions openeducat_core/models/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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!"))

Expand Down
2 changes: 1 addition & 1 deletion openeducat_core/models/subject_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion openeducat_core/views/student_course_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<group>
<group>
<field name="student_id"/>
<field name="batch_id" domain="[('course_id', '=', course_id)]"/>
<field name="batch_id" domain="[('course_id', '=', course_id)]" required="1"/>
<field name="academic_years_id"/>
</group>
<group>
Expand Down
8 changes: 4 additions & 4 deletions openeducat_core/views/student_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<field name="middle_name" placeholder="Middle Name"/>
</td>
<td style="padding-right:10px;">
<field name="last_name" placeholder="Last Name"/>
<field name="last_name" placeholder="Last Name" required="1"/>
</td>
</tr>
</table>
Expand All @@ -127,7 +127,7 @@
<group name="personal_detail">
<group>
<field name="gender" required="1"/>
<field name="birth_date" required="1"/>
<field name="birth_date"/>
<label for="type"/>
<div name="div_type">
<field class="oe_inline" name="type"/>
Expand All @@ -149,8 +149,8 @@
options="{&quot;always_reload&quot;: True}"/>
</group>
<group>
<field name="email" required="1"/>
<field name="mobile" required="1"/>
<field name="email"/>
<field name="mobile"/>
<field name="lang"/>
<field name="blood_group"/>
<field name="nationality"/>
Expand Down
2 changes: 1 addition & 1 deletion openeducat_core/views/subject_registration_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<group>
<group>
<field name="student_id"/>
<field name="batch_id" domain="[('course_id', '=', course_id)]"/>
<field name="batch_id" domain="[('course_id', '=', course_id)]" required='1'/>
<field name="max_unit_load"/>
</group>
<group>
Expand Down

0 comments on commit 60e69b1

Please sign in to comment.