Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1842 Lượt xem

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 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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

Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
CLIENTE DUPLICADO Đã xử lý
3
thg 3 24
2593
2
thg 12 15
2856
2
thg 12 23
2638
1
thg 11 21
4167
3
thg 1 16
6186