Skip to content
Snippets Groups Projects
Commit d6d30819 authored by Unknown's avatar Unknown Committed by Yannick Tivisse
Browse files

[IMP] hr_recruitment: Add kanban state to recruitment pipeline

Purpose
=======

recruitment pipeline lacks a kanban state management

Specifications
==============

Add kanban state management like what is already done in project:
- A kanban state was added to the recruitment pipeline. The kanban colored dot is visible in the kanban view and in the form view.
- A search filter on the kanban state was also added.

Project : RD for Dummies
Task : 1819164
parent e1f2e723
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,12 @@ class RecruitmentStage(models.Model): ...@@ -63,6 +63,12 @@ class RecruitmentStage(models.Model):
fold = fields.Boolean( fold = fields.Boolean(
"Folded in Recruitment Pipe", "Folded in Recruitment Pipe",
help="This stage is folded in the kanban view when there are no records in that stage to display.") help="This stage is folded in the kanban view when there are no records in that stage to display.")
legend_blocked = fields.Char(
'Red Kanban Label', default=lambda self: _('Blocked'), translate=True, required=True)
legend_done = fields.Char(
'Green Kanban Label', default=lambda self: _('Ready for Next Stage'), translate=True, required=True)
legend_normal = fields.Char(
'Grey Kanban Label', default=lambda self: _('In Progress'), translate=True, required=True)
@api.model @api.model
def default_get(self, fields): def default_get(self, fields):
...@@ -156,6 +162,15 @@ class Applicant(models.Model): ...@@ -156,6 +162,15 @@ class Applicant(models.Model):
attachment_number = fields.Integer(compute='_get_attachment_number', string="Number of Attachments") attachment_number = fields.Integer(compute='_get_attachment_number', string="Number of Attachments")
employee_name = fields.Char(related='emp_id.name', string="Employee Name") employee_name = fields.Char(related='emp_id.name', string="Employee Name")
attachment_ids = fields.One2many('ir.attachment', 'res_id', domain=[('res_model', '=', 'hr.applicant')], string='Attachments') attachment_ids = fields.One2many('ir.attachment', 'res_id', domain=[('res_model', '=', 'hr.applicant')], string='Attachments')
kanban_state = fields.Selection([
('normal', 'Grey'),
('done', 'Green'),
('blocked', 'Red')], string='Kanban State',
copy=False, default='normal', required=True)
legend_blocked = fields.Char(related='stage_id.legend_blocked', string='Kanban Blocked')
legend_done = fields.Char(related='stage_id.legend_done', string='Kanban Valid')
legend_normal = fields.Char(related='stage_id.legend_normal', string='Kanban Ongoing')
@api.depends('date_open', 'date_closed') @api.depends('date_open', 'date_closed')
@api.one @api.one
...@@ -267,6 +282,8 @@ class Applicant(models.Model): ...@@ -267,6 +282,8 @@ class Applicant(models.Model):
if 'stage_id' in vals: if 'stage_id' in vals:
vals['date_last_stage_update'] = fields.Datetime.now() vals['date_last_stage_update'] = fields.Datetime.now()
vals.update(self._onchange_stage_id_internal(vals.get('stage_id'))['value']) vals.update(self._onchange_stage_id_internal(vals.get('stage_id'))['value'])
if 'kanban_state' not in vals:
vals['kanban_state'] = 'normal'
for applicant in self: for applicant in self:
vals['last_stage_id'] = applicant.stage_id.id vals['last_stage_id'] = applicant.stage_id.id
res = super(Applicant, self).write(vals) res = super(Applicant, self).write(vals)
......
...@@ -53,4 +53,11 @@ ...@@ -53,4 +53,11 @@
} }
} }
} }
} }
\ No newline at end of file
.o_kanban_view .oe_kanban_card {
.o_kanban_state_with_padding {
padding-left:7%;
padding-bottom:5%;
}
}
...@@ -102,6 +102,10 @@ ...@@ -102,6 +102,10 @@
options='{"terminology": "archive"}'/> options='{"terminology": "archive"}'/>
</button> </button>
</div> </div>
<field name="kanban_state" widget="kanban_state_selection"/>
<field name="legend_normal" invisible="1"/>
<field name="legend_blocked" invisible="1"/>
<field name="legend_done" invisible="1"/>
<div class="oe_title"> <div class="oe_title">
<label for="name" class="oe_edit_only"/> <label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1> <h1><field name="name"/></h1>
...@@ -201,6 +205,10 @@ ...@@ -201,6 +205,10 @@
<field name="user_id"/> <field name="user_id"/>
<field name="stage_id" domain="[]"/> <field name="stage_id" domain="[]"/>
<separator/> <separator/>
<filter string="Ready for Next Stage" name="done" domain="[('kanban_state', '=', 'done')]"/>
<filter string="Blocked" name="blocked" domain="[('kanban_state', '=', 'blocked')]"/>
<filter string="In progress" name="in_progress" domain="[('kanban_state', '=', 'normal')]"/>
<separator/>
<filter string="My Activities" name="activities_my" <filter string="My Activities" name="activities_my"
domain="[('activity_ids.user_id', '=', uid)]"/> domain="[('activity_ids.user_id', '=', uid)]"/>
<separator/> <separator/>
...@@ -324,6 +332,12 @@ ...@@ -324,6 +332,12 @@
<t t-esc="record.attachment_number.raw_value"/> <t t-esc="record.attachment_number.raw_value"/>
</span> </span>
</a> </a>
<div class="o_kanban_state_with_padding">
<field name="kanban_state" widget="kanban_state_selection"/>
<field name="legend_normal" invisible="1"/>
<field name="legend_blocked" invisible="1"/>
<field name="legend_done" invisible="1"/>
</div>
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="30" height="30" class="oe_kanban_avatar"/> <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="30" height="30" class="oe_kanban_avatar"/>
</div> </div>
...@@ -708,6 +722,18 @@ ...@@ -708,6 +722,18 @@
<field name="template_id" domain= "[('model_id.model', '=', 'hr.applicant')]"/> <field name="template_id" domain= "[('model_id.model', '=', 'hr.applicant')]"/>
</group> </group>
</group> </group>
<group string="Tooltips">
<p class="text-muted" colspan="2">
You can define here the labels that will be displayed for the kanban state instead
of the default labels.
</p>
<label for="legend_normal" string=" " class="o_status"/>
<field name="legend_normal" nolabel="1"/>
<label for="legend_blocked" string=" " class="o_status o_status_red"/>
<field name="legend_blocked" nolabel="1"/>
<label for="legend_done" string=" " class="o_status o_status_green"/>
<field name="legend_done" nolabel="1"/>
</group>
<separator string="Requirements"/> <separator string="Requirements"/>
<field name="requirements"/> <field name="requirements"/>
</form> </form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment