Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MOD]fixed raised issue in admission #783

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[17.0][MOD]fixed raised issue in admission
  • Loading branch information
sumitprajapati2003 committed Sep 18, 2024
commit 1a3b645456cbe02520226f1fc39cf54ee1cfb8f9
15 changes: 10 additions & 5 deletions openeducat_admission/models/admission.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ class OpAdmission(models.Model):
'Email', size=256, required=True)
city = fields.Char('City', size=64)
zip = fields.Char('Zip', size=8)
state_id = fields.Many2one(
'res.country.state', 'States')
country_id = fields.Many2one(
'res.country', 'Country')
state_id = fields.Many2one(
'res.country.state', 'States' ,domain="[('country_id', '=', country_id)]")
fees = fields.Float('Fees')
image = fields.Image('image')
state = fields.Selection(
Expand Down Expand Up @@ -178,6 +178,11 @@ def onchange_course(self):
term_id = self.course_id.fees_term_id.id
self.fees_term_id = term_id

@api.onchange('state_id')
def _onchange_state(self):
if self.state_id.country_id and self.country_id != self.state_id.country_id:
self.country_id = self.state_id.country_id

@api.constrains('register_id', 'application_date')
def _check_admission_register(self):
for rec in self:
Expand Down Expand Up @@ -350,9 +355,9 @@ 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'))
# if not record.mobile:
# raise UserError(
# _('Please fill in the mobile number'))
reg_id.get_subjects()

def confirm_rejected(self):
Expand Down
18 changes: 18 additions & 0 deletions openeducat_admission/models/admission_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ 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',
default=lambda self: self.env.user.company_id)

@api.onchange('name')
def _onchange_name(self):
if self.name:
self.name = self.name[0].upper() + self.name[1:]

@api.constrains('start_date', 'end_date')
def check_dates(self):
for record in self:
Expand All @@ -88,6 +94,18 @@ def check_no_of_admission(self):
raise ValidationError(_(
"Min Admission can't be greater than Max Admission"))

def action_open_student(self):
return {
"type": "ir.actions.act_window",
"res_model": "op.admission",
"domain": [("register_id", "=", self.id)],
"name": "Applications",
"view_mode": "tree,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
27 changes: 7 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="action_open_student"
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,7 @@
<field name="academic_years_id" readonly="state != 'draft'"/>
</group>
</group>
<notebook>
<page string="Applications" name="applications">
<field name="admission_ids" nolabel="1" readonly="1">
<tree 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"/>
</tree>
</field>
</page>
</notebook>

</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
Expand Down
41 changes: 15 additions & 26 deletions openeducat_admission/views/admission_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,38 +131,27 @@
<group>
<field name="gender" readonly="state == 'done'"/>
<field name="email" placeholder="Email" readonly="state == 'done'"/>
<label for="street" string="Address"/>
<div name="o_address_format">
<field name="street" placeholder="Street..." readonly="state == 'done'"/>
<field name="street2" placeholder="Street2" readonly="state == 'done'"/>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%" readonly="state == 'done'"/>
<field name="state_id" class="oe_no_button" placeholder="State"
style="width: 37%" options="{&quot;no_open&quot;: True}" readonly="state == 'done'"/>
<field name="zip" placeholder="ZIP" style="width: 20%" readonly="state == 'done'"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button"
options="{&quot;no_open&quot;: True}" readonly="state == 'done'"/>
</div>
</group>
<group>
<field name="birth_date" options="{'datepicker':{'warn_future': true}}"
readonly="state == 'done'"/>
<field name="phone" placeholder="Phone" widget="phone" readonly="state == 'done'"/>
<field name="mobile" placeholder="Mobile" widget="phone" readonly="state == 'done'"/>
</group>
</group>
<label for="street" string="Address"/>
<div>
<div>
<field name="street" placeholder="Street..." nolabel="1" style="width: 100%%"
readonly="state == 'done'"/>
<field name="street2" placeholder="Street 2..." nolabel="1"
readonly="state == 'done'"
style="width: 100%%"/>
</div>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%%"
readonly="state == 'done'"/>
<field name="state_id" options='{"no_open": True}' readonly="state == 'done'"
placeholder="State" style="width: 24%%"/>
<field name="zip" placeholder="ZIP" style="width: 34%%"
readonly="state == 'done'"/>
</div>
<div>
<field name="country_id" placeholder="Country" options='{"no_open": True}'
nolabel="1" readonly="state == 'done'"/>
<field name="phone" placeholder="Phone" nolabel="1" style="width: 100%%"
readonly="state == 'done'" required="state == 'submit'"/>
<field name="mobile" placeholder="Mobile" nolabel="1" style="width: 100%%"
readonly="state == 'done'" required="state == 'submit'"/>
</div>
</div>
<group>
<group>
<field name="family_business" readonly="state == 'done'"/>
Expand Down