Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
1708 Tampilan

Hi,

We are using agencies to recruit people. They send in CV and applications and we create the application in the recruitment app. We want to see if an already refused applicant has been sent in by another agency. How do we filter to look for duplicates in both active and refused applicants at the same time?

Regards,

Tord Røsstad 

Avatar
Buang
Jawaban Terbai

Hello Tord Røsstad,


I trust you're doing well.


For scenarios like this, you have two approaches: utilising automated actions or implementing a create method. I'll explain both methods below.

Please find code in comment. 

For creating an automated action, please refer to the attached screenshot.

If you have any questions or need further clarification, feel free to ask.

I hope this will help you.
Thanks & Regards,
Email:    odoo@aktivsoftware.com     

Skype: kalpeshmaheshwari

Avatar
Buang

Please find code here :-
Using the create method:
class Applicant(models.Model):
_inherit = "hr.applicant"

@api.model_create_multi
def create(self, vals_list):
records = super(Applicant, self).create(vals_list)
for record in records:
partner_names = self.env['hr.applicant'].search([('partner_name', 'ilike', record.partner_name), ('active', 'in', [True, False])]).mapped('partner_name')
if len(partner_names) > 1:
raise UserError('You Cannot Create the Same Applicant')
return records

Penulis

Hello Jainesh,

This is great, thank you!
The only adjustment we need to make is that the client should be able to create applications with the same applicants name, as two people can share the same name. How do we make the user aware of a potential duplicate upon creation, but still let them create it if necessary (remove the blocker of UserError)?

Kind regards,
Tord Røsstad

Post Terkait Replies Tampilan Aktivitas
CLIENTE DUPLICADO Diselesaikan
3
Mar 24
2480
2
Des 15
2856
2
Des 23
2475
1
Nov 21
4038
3
Jan 16
6072