跳至內容
選單
此問題已被標幟
1 回覆
1820 瀏覽次數

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 

頭像
捨棄
最佳答案

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

頭像
捨棄

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

作者

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

相關帖文 回覆 瀏覽次數 活動
3
3月 24
2577
2
12月 15
2856
2
12月 23
2611
1
11月 21
4136
3
1月 16
6169