[REV] website_hr_recruitment: revert ee91d1e

This commit would makes us very vulnerable to spams and malevolent
bots who would forge e-mails to force the creation of a res_partner
for each e-mail, quickly overloading the database. I'm reverting
this as it was requested by al.

After discussion with yti, the original issue was that to use the
mail thread on the hr application, the user needed to create a
res_partner just to send him a mail, even if he was refused.

A proposed solution would be to add the e-mail of the applicant
to the suggested recipients of the mail thread.
This commit is contained in:
David Monjoie
2015-04-30 16:48:22 +02:00
parent 203508e551
commit 1e4b7c42fa
@@ -116,22 +116,6 @@ class website_hr_recruitment(http.Controller):
# Retro-compatibility for saas-3. "phone" field should be replace by "partner_phone" in the template in trunk.
value['partner_phone'] = post.pop('phone', False)
# If the email is already known in our database, match it to the existing partner, else create a new one
Partner = env['res.partner']
existing_partner = Partner.name_search(name=post.get('email_from').strip(), args=[('is_company', '=', False)], limit=1)
if not existing_partner:
value_partner = {
'name': post['partner_name'],
'email': post['email_from'],
'phone': value['partner_phone'],
}
partner = Partner.create(value_partner)
value['partner_id'] = partner.id
else:
value['partner_id'] = existing_partner[0][0]
# Create applicant
applicant = env['hr.applicant'].create(value)
if post['ufile']:
name = applicant.partner_name if applicant.partner_name else applicant.name