diff --git a/hr_recruitment_pgk/models/hr_applicant.py b/hr_recruitment_pgk/models/hr_applicant.py
index bc23cf3..f201613 100644
--- a/hr_recruitment_pgk/models/hr_applicant.py
+++ b/hr_recruitment_pgk/models/hr_applicant.py
@@ -5,6 +5,8 @@ class HrApplicant(models.Model):
_inherit = "hr.applicant"
vat = fields.Char(string='CUIL')
+
+ old_postulation = fields.Boolean(string='Postulación antigua')
def create_employee_from_applicant(self):
dict_act_window = super(HrApplicant, self).create_employee_from_applicant()
@@ -19,4 +21,19 @@ def create_employee_from_applicant(self):
'default_identification_id': applicant.vat,
})
return dict_act_window
+
+
+ @api.model
+ def create(self, vals):
+ # Verificar si el campo 'cuil' está en los valores
+ if 'vat' in vals:
+ # Buscar en la base de datos si ya existe un registro con ese 'cuil'
+ existing_applicant = self.with_context(active_test=False).search([('vat', '=', vals['vat'])], limit=1)
+ if existing_applicant:
+ # Agregar 'old_postulation' al vals
+ vals['old_postulation'] = True
+
+ # Crear el nuevo registro
+ res = super(HrApplicant, self).create(vals)
+ return res
\ No newline at end of file
diff --git a/hr_recruitment_pgk/views/hr_applicant_views.xml b/hr_recruitment_pgk/views/hr_applicant_views.xml
index 839b374..1b40c51 100644
--- a/hr_recruitment_pgk/views/hr_applicant_views.xml
+++ b/hr_recruitment_pgk/views/hr_applicant_views.xml
@@ -8,6 +8,19 @@
+
+
+
+
+
+
+ hr.applicant.view.tree
+ hr.applicant
+
+
+
+
+