diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index bcb5b55445e602d019a2a50b86acd62f889f91be..9bc544bab1ecfedd855e9f1e290710370e553446 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -63,6 +63,12 @@ class RecruitmentStage(models.Model): fold = fields.Boolean( "Folded in Recruitment Pipe", 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 def default_get(self, fields): @@ -156,6 +162,15 @@ class Applicant(models.Model): attachment_number = fields.Integer(compute='_get_attachment_number', string="Number of Attachments") 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') + 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.one @@ -267,6 +282,8 @@ class Applicant(models.Model): if 'stage_id' in vals: vals['date_last_stage_update'] = fields.Datetime.now() 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: vals['last_stage_id'] = applicant.stage_id.id res = super(Applicant, self).write(vals) diff --git a/addons/hr_recruitment/static/src/scss/hr_job.scss b/addons/hr_recruitment/static/src/scss/hr_job.scss index 852a06d10c2287eed34b12b1f768e136515c2e94..671d7d20882e63cf6bc18a3289315f89edbbe315 100644 --- a/addons/hr_recruitment/static/src/scss/hr_job.scss +++ b/addons/hr_recruitment/static/src/scss/hr_job.scss @@ -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%; + } +} diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml index 0d5664d61421c9f71b9b26fc9fbaa40232e5e8ce..b46e557be71c7095c6ea03f352f18e8ece628efb 100644 --- a/addons/hr_recruitment/views/hr_recruitment_views.xml +++ b/addons/hr_recruitment/views/hr_recruitment_views.xml @@ -102,6 +102,10 @@ options='{"terminology": "archive"}'/> </button> </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"> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> @@ -201,6 +205,10 @@ <field name="user_id"/> <field name="stage_id" domain="[]"/> <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" domain="[('activity_ids.user_id', '=', uid)]"/> <separator/> @@ -324,6 +332,12 @@ <t t-esc="record.attachment_number.raw_value"/> </span> </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"/> </div> @@ -708,6 +722,18 @@ <field name="template_id" domain= "[('model_id.model', '=', 'hr.applicant')]"/> </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"/> <field name="requirements"/> </form>