[FIX] hr_recruitment: Include archived applicants on job's button count
Currently in the job's stat button and on kanban button the archived applicants are not counted and not display while click on button. So in this commit, count of the archived applicant's in form views and show the archived applicants when clicked on stat button. also curently there is no indication for applicant is refused or not so in this commit add badge on kanban and form for archieve(refused) applicant. we should not count the archived applicantion in the kanban button. closes odoo/odoo#55755 Taskid: 2308448 Closes: #55104 X-original-commit: d272d0bbaa5847753236bbee11bff94683cb66f4 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
committed by
Yannick Tivisse
parent
07fbfbb5fb
commit
40146bff7f
@@ -23,6 +23,7 @@ class Job(models.Model):
|
||||
help="Address where employees are working")
|
||||
application_ids = fields.One2many('hr.applicant', 'job_id', "Applications")
|
||||
application_count = fields.Integer(compute='_compute_application_count', string="Application Count")
|
||||
all_application_count = fields.Integer(compute='_compute_all_application_count', string="All Application Count")
|
||||
new_application_count = fields.Integer(
|
||||
compute='_compute_new_application_count', string="New Application",
|
||||
help="Number of applications that are new in the flow (typically at first step of the flow)")
|
||||
@@ -74,6 +75,12 @@ class Job(models.Model):
|
||||
job.document_ids = result[job.id]
|
||||
job.documents_count = len(job.document_ids)
|
||||
|
||||
def _compute_all_application_count(self):
|
||||
read_group_result = self.env['hr.applicant'].with_context(active_test=False).read_group([('job_id', 'in', self.ids)], ['job_id'], ['job_id'])
|
||||
result = dict((data['job_id'][0], data['job_id_count']) for data in read_group_result)
|
||||
for job in self:
|
||||
job.all_application_count = result.get(job.id, 0)
|
||||
|
||||
def _compute_application_count(self):
|
||||
read_group_result = self.env['hr.applicant'].read_group([('job_id', 'in', self.ids)], ['job_id'], ['job_id'])
|
||||
result = dict((data['job_id'][0], data['job_id_count']) for data in read_group_result)
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<field name="meeting_count" widget="statinfo" string="Meetings"/>
|
||||
</button>
|
||||
</div>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<widget name="web_ribbon" title="Refused" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<field name="kanban_state" widget="kanban_state_selection"/>
|
||||
<field name="active" invisible="1"/>
|
||||
<field name="legend_normal" invisible="1"/>
|
||||
@@ -285,6 +285,7 @@
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="{{!selection_mode ? 'oe_kanban_color_' + kanban_getcolor(record.color.raw_value) : ''}} oe_kanban_card oe_kanban_global_click oe_applicant_kanban oe_semantic_html_override">
|
||||
<span class="badge badge-pill badge-danger pull-right mr-4" attrs="{'invisible': [('active', '=', True)]}">Refused</span>
|
||||
<div class="o_dropdown_kanban dropdown">
|
||||
<a class="dropdown-toggle o-no-caret btn" role="button" data-toggle="dropdown" href="#" aria-label="Dropdown menu" title="Dropdown menu">
|
||||
<span class="fa fa-ellipsis-v"/>
|
||||
@@ -467,9 +468,9 @@
|
||||
<button class="oe_stat_button"
|
||||
icon="fa-pencil"
|
||||
name="%(action_hr_job_applications)d"
|
||||
context="{'default_user_id': user_id}"
|
||||
context="{'default_user_id': user_id, 'active_test': False}"
|
||||
type="action">
|
||||
<field name="application_count" widget="statinfo" string="Applications"/>
|
||||
<field name="all_application_count" widget="statinfo" string="Applications"/>
|
||||
</button>
|
||||
<button class="oe_stat_button"
|
||||
icon="fa-file-text-o"
|
||||
|
||||
Reference in New Issue
Block a user