Skip to content

Commit

Permalink
Merge pull request #594 from calyx-servicios/ODOO-8194-STG
Browse files Browse the repository at this point in the history
[ODOO-8194-STG][UPD][HR_RECRUITMENT_PGK]
  • Loading branch information
Leandro090685 authored Aug 30, 2024
2 parents d962f35 + 7abaadd commit c31c81c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions hr_recruitment_pgk/models/hr_applicant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

13 changes: 13 additions & 0 deletions hr_recruitment_pgk/views/hr_applicant_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='email_from']" position="after">
<field name="vat"/>
<field name="old_postulation"/>
</xpath>
</field>
</record>

<record id="hr_applicant_view_tree" model="ir.ui.view">
<field name="name">hr.applicant.view.tree</field>
<field name="model">hr.applicant</field>
<field name="inherit_id" ref="hr_recruitment.crm_case_tree_view_job"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="old_postulation"/>
<field name="vat"/>
</xpath>
</field>
</record>
Expand Down

0 comments on commit c31c81c

Please sign in to comment.