Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1709 Widoki

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 

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

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

Autor

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

Powiązane posty Odpowiedzi Widoki Czynność
3
mar 24
2482
2
gru 15
2856
2
gru 23
2477
1
lis 21
4038
3
sty 16
6072