[REV] hr_recruitment_skills: remove Populate feature
Partial revert of #93126. closes odoo/odoo#94554 Taskid: 2894671 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -2,4 +2,3 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -13,21 +13,11 @@
|
||||
'views/hr_applicant_views.xml',
|
||||
'views/hr_applicant_skill_views.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/hr_recruitment_populate_wizard_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': True,
|
||||
'assets': {
|
||||
'web.assets_backend': [
|
||||
'hr_recruitment_skills/static/src/**/*.js',
|
||||
],
|
||||
'web.assets_qweb': [
|
||||
'hr_recruitment_skills/static/src/xml/**/*',
|
||||
'hr_recruitment_skills/static/src/**/*.xml',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
hr_recruitment_skills.access_hr_applicant_skill,access_hr_applicant_skill,hr_recruitment_skills.model_hr_applicant_skill,hr_recruitment.group_hr_recruitment_user,1,1,1,1
|
||||
hr_recruitment_skills.access_hr_recruitment_populate_wizard,access_hr_recruitment_populate_wizard,hr_recruitment_skills.model_hr_recruitment_populate_wizard,hr_recruitment.group_hr_recruitment_user,1,1,1,0
|
||||
hr_recruitment_skills.access_hr_applicant_skill,access_hr_applicant_skill,hr_recruitment_skills.model_hr_applicant_skill,hr_recruitment.group_hr_recruitment_user,1,1,1,1
|
||||
|
@@ -1,59 +0,0 @@
|
||||
odoo.define('hr.applicant.view.kanban', function (require) {
|
||||
"use strict";
|
||||
var core = require('web.core');
|
||||
var KanbanController = require('web.KanbanController');
|
||||
var KanbanView = require('web.KanbanView');
|
||||
var viewRegistry = require('web.view_registry');
|
||||
|
||||
var QWeb = core.qweb;
|
||||
|
||||
var ApplicantKanbanController = KanbanController.extend({
|
||||
/**
|
||||
* Extends the renderButtons function of KanbanView by adding a button
|
||||
* on the applicant view.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
renderButtons: function () {
|
||||
this._super.apply(this, arguments);
|
||||
this.$buttons.append($(QWeb.render("ApplicantKanbanView.populate_button", this)));
|
||||
var self = this;
|
||||
this.$buttons.on('click', '.o_button_recruitment_populate', function () {
|
||||
self.do_action('hr_recruitment_skills.hr_recruitment_populate_wizard_action', {
|
||||
additional_context: {active_id: self.model.get(self.handle).context.active_id},
|
||||
on_close: function () {
|
||||
self.trigger_up('reload');
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_onSearch: async function (searchQuery) {
|
||||
this._super.apply(this, arguments);
|
||||
var activeID = this.model.get(this.handle).context.active_id;
|
||||
var jobID = undefined;
|
||||
if (searchQuery.domain && !_.isEmpty(searchQuery.domain)) {
|
||||
searchQuery.domain.forEach(elem => {
|
||||
if (elem.length === 3 && elem[0] === 'job_id') {
|
||||
jobID = elem[2];
|
||||
}
|
||||
})
|
||||
}
|
||||
if (activeID === jobID) {
|
||||
$('button.o_button_recruitment_populate').removeClass('d-none');
|
||||
} else {
|
||||
$('button.o_button_recruitment_populate').addClass('d-none');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var PayslipKanbanView = KanbanView.extend({
|
||||
config: _.extend({}, KanbanView.prototype.config, {
|
||||
Controller: ApplicantKanbanController,
|
||||
}),
|
||||
});
|
||||
|
||||
viewRegistry.add('hr_applicant_kanban', PayslipKanbanView);
|
||||
|
||||
return ApplicantKanbanController;
|
||||
});
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-name="ApplicantKanbanView.populate_button">
|
||||
<button type="button" class="btn btn-secondary o_button_recruitment_populate">
|
||||
Populate
|
||||
</button>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import hr_recruitment_populate_wizard
|
||||
@@ -1,46 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo.osv.expression import AND
|
||||
|
||||
|
||||
class HrRecruitmentPopulateWizard(models.TransientModel):
|
||||
_name = 'hr.recruitment.populate.wizard'
|
||||
_description = 'Populate Job Position Wizard'
|
||||
|
||||
job_id = fields.Many2one('hr.job', default=lambda self: self.env.context.get('active_id'))
|
||||
skill_ids = fields.Many2many('hr.skill', string="Skills")
|
||||
categ_ids = fields.Many2many('hr.applicant.category', string="Tags")
|
||||
degree_id = fields.Many2one('hr.recruitment.degree', "Degree") # on hr.applicant: type_id
|
||||
availability = fields.Selection(
|
||||
selection=[
|
||||
('now', 'Immediately'),
|
||||
('quarter', 'In the next 3 months'),
|
||||
('year', 'In the coming year'),
|
||||
],
|
||||
required=True,
|
||||
default='now')
|
||||
|
||||
def action_validate(self):
|
||||
self.ensure_one()
|
||||
domain = [('job_id', '=', False)]
|
||||
if self.skill_ids:
|
||||
domain = AND([domain, [('applicant_skill_ids.skill_id', 'in', self.skill_ids.ids)]])
|
||||
if self.categ_ids:
|
||||
domain = AND([domain, [('categ_ids', 'in', self.categ_ids.ids)]])
|
||||
if self.degree_id:
|
||||
domain = AND([domain, [('type_id', '=', self.degree_id.id)]])
|
||||
|
||||
today = fields.Date.today()
|
||||
if self.availability == 'now':
|
||||
domain = AND([domain, ['|', ('availability', '=', False), ('availability', '<=', today)]])
|
||||
elif self.availability == 'quarter':
|
||||
domain = AND([domain, ['|', ('availability', '=', False), ('availability', '<=', today + relativedelta(months=3))]])
|
||||
else:
|
||||
domain = AND([domain, ['|', ('availability', '=', False), ('availability', '<=', today + relativedelta(years=1))]])
|
||||
|
||||
reserve = self.env['hr.applicant'].search(domain)
|
||||
reserve.job_id = self.job_id
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="hr_recruitment_populate_wizard_view_form" model="ir.ui.view">
|
||||
<field name="name">hr.recruitment.populate.wizard.view.form</field>
|
||||
<field name="model">hr.recruitment.populate.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Populate Job Position">
|
||||
<sheet>
|
||||
<div class="text-muted mb-2">
|
||||
Search among all the available applicants in the reserve pool
|
||||
based on one or more criteria.
|
||||
The applicants will be automatically assigned to this job position.
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="job_id" invisible="1"/>
|
||||
<field name="skill_ids" widget="many2many_tags"/>
|
||||
<field name="categ_ids" widget="many2many_tags"/>
|
||||
<field name="degree_id"/>
|
||||
<field name="availability"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button string="Populate" name="action_validate" type="object" class="btn-primary"/>
|
||||
<button special="cancel" string="Close" type="object" class="btn-secondary"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_recruitment_populate_wizard_action" model="ir.actions.act_window">
|
||||
<field name="name">Populate Job Position</field>
|
||||
<field name="res_model">hr.recruitment.populate.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user