Skip to content

Commit

Permalink
Merge pull request #830 from mehul0812/18.0-mehul-admission-issue
Browse files Browse the repository at this point in the history
[18.0] [ADD] added application smart button
  • Loading branch information
parthivgls authored Nov 12, 2024
2 parents c9c5a3a + c8240a7 commit 52a333b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
3 changes: 0 additions & 3 deletions openeducat_admission/models/admission.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,6 @@ def enroll_student(self):
'max_unit_load': record.course_id.max_unit_load or 0.0,
'state': 'draft',
})
if not record.mobile:
raise UserError(
_('Please fill in the mobile number'))
reg_id.get_subjects()

def confirm_rejected(self):
Expand Down
13 changes: 13 additions & 0 deletions openeducat_admission/models/admission_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class OpAdmissionRegister(models.Model):
'Terms', readonly=True,
tracking=True)
minimum_age_criteria = fields.Integer('Minimum Required Age(Years)', default=3)
application_count = fields.Integer(string="Total_record", compute="calculate_record_application")

company_id = fields.Many2one(
'res.company', string='Company',
Expand All @@ -88,6 +89,18 @@ def check_no_of_admission(self):
raise ValidationError(_(
"Min Admission can't be greater than Max Admission"))

def open_student_application(self):
return {
"type": "ir.actions.act_window",
"res_model": "op.admission",
"domain": [("register_id", "=", self.id)],
"name": "Applications",
"view_mode": "list,form",
}
def calculate_record_application(self):
record = self.env["op.admission"].search_count([("register_id", "=", self.id)])
self.application_count = record

def confirm_register(self):
self.state = 'confirm'

Expand Down
26 changes: 6 additions & 20 deletions openeducat_admission/views/admission_register_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,application,admission"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="open_student_application"
type="object" icon="fa-id-card" style="border-right: 1px solid;">
<field string="Applications" name="application_count" widget="statinfo"/>
</button>
</div>
<field name="active" invisible="1"/>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger"
invisible="active == True"/>
Expand All @@ -67,26 +73,6 @@
<field name="academic_years_id" readonly="state != 'draft'"/>
</group>
</group>
<notebook>
<page string="Applications" name="applications">
<field name="admission_ids" nolabel="1" readonly="1">
<list string="Registration">
<field name="application_number"/>
<field name="title" optional="show"/>
<field name="name"/>
<field name="admission_date"/>
<field name="application_date"/>
<field name="course_id"/>
<field name="batch_id" optional="hide"/>
<field name="state"/>
<field name="company_id" groups="base.group_multi_company" optional="show"/>
<field name="gender" optional="hide"/>
<field name="birth_date" optional="hide"/>
<field name="email" optional="hide"/>
</list>
</field>
</page>
</notebook>
</sheet>
<chatter/>
</form>
Expand Down

0 comments on commit 52a333b

Please sign in to comment.