diff --git a/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard.py b/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard.py index 3979d0c06..19760fec8 100644 --- a/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard.py +++ b/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard.py @@ -483,6 +483,10 @@ class HrRecruitmentAutoDocWizard(models.TransientModel): } def _get_jd_required_fields(self): + category_dict = { + str(category['id']): category['category_name'] + for category in self.env['job.category'].sudo().search_read([], ['id', 'category_name']) + } return { "request_id": {"type": "string", "description": "Request or requisition identifier"}, "start_date": {"type": "string", "description": "Requested start date"}, @@ -495,6 +499,7 @@ class HrRecruitmentAutoDocWizard(models.TransientModel): "secondary_skills": {"type": "list", "description": "Secondary or nice to have skills"}, "budget": {"type": "string", "description": "Budget or salary range"}, "experience_years": {"type": "float", "description": "Expected total years of experience"}, + "job_category": {"type": "selection", "description": "Based on over all Job description which one matches more accurately give me the key: %s"%(category_dict)} } def _get_resume_prompt(self): @@ -1766,8 +1771,11 @@ class HrRecruitmentAutoDocWizard(models.TransientModel): "secondary_skill_ids": [(6, 0, secondary_skills.ids)] if secondary_skills else False, } job_category = self._match_job_category(parsed_data, parsed_payload) - if job_category: - write_vals["job_category"] = job_category.id + + if job_request and job_request.job_category: + if job_request.job_id and job_request.job_id.job_category != job_request.job_category: + job_request.job_id.job_category = job_request.job_category.id + elif job_category: if job_request.job_id and job_request.job_id.job_category != job_category: job_request.job_id.job_category = job_category.id write_vals = {key: value for key, value in write_vals.items() if value not in (False, None, "")} @@ -1805,7 +1813,14 @@ class HrRecruitmentAutoDocWizard(models.TransientModel): job_category = self._match_job_category(parsed_data, parsed_payload) if job_category and job.job_category != job_category: job.job_category = job_category.id + category_dict = { + str(category['id']): category['category_name'] + for category in self.env['job.category'].search_read([], ['id', 'category_name']) + } + reverse_category = {v: k for k, v in category_dict.items()} + job_category = parsed_data.get("job_category") + job_category_id = reverse_category.get(job_category, job_category) create_vals = { "job_id": job.id, "company_id": self.env.company.id, @@ -1813,12 +1828,17 @@ class HrRecruitmentAutoDocWizard(models.TransientModel): "requirements": parsed_data.get("requirements"), "target_from": self._parse_date_value(parsed_data.get("start_date")), "target_to": self._parse_date_value(parsed_data.get("end_date")), - "job_category": job_category.id if job_category else False, + "job_category": int(job_category_id) if job_category_id and job_category_id.isdigit() else False, + "address_id":False, + "recruitment_type": 'external' + } if request_id: create_vals["recruitment_sequence"] = request_id create_vals = {key: value for key, value in create_vals.items() if value not in (False, None, "")} - return job_request_model.create(create_vals), "created" + job_request = job_request_model.create(create_vals) + job_request.sudo().write({"address_id" : False}) + return job_request, "created" def _match_existing_job_position(self, job_title): hr_job_model = self.env["hr.job"] diff --git a/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard_views.xml b/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard_views.xml index 5bcf5ced6..83038e1b5 100644 --- a/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard_views.xml +++ b/addons_extensions/hr_recruitment_auto_doc/wizard/hr_recruitment_auto_doc_wizard_views.xml @@ -5,10 +5,10 @@ hr.recruitment.auto.doc.wizard
-
-
+ + + + @@ -39,7 +39,15 @@ invisible="1"/> - +
+
+ + diff --git a/addons_extensions/hr_recruitment_extended/views/hr_job_recruitment.xml b/addons_extensions/hr_recruitment_extended/views/hr_job_recruitment.xml index 87d4ab30f..5b5e0a27a 100644 --- a/addons_extensions/hr_recruitment_extended/views/hr_job_recruitment.xml +++ b/addons_extensions/hr_recruitment_extended/views/hr_job_recruitment.xml @@ -429,6 +429,7 @@ Job Positions Recruitment hr.job.recruitment kanban,list,form +

@@ -446,6 +447,7 @@ hr.job.recruitment kanban,list,form,search + {"search_default_open_status":1,"search_default_my_assignments":1}