diff --git a/addons/website_hr_recruitment/__openerp__.py b/addons/website_hr_recruitment/__openerp__.py index 98257e2eb19..2b204c8c181 100644 --- a/addons/website_hr_recruitment/__openerp__.py +++ b/addons/website_hr_recruitment/__openerp__.py @@ -8,7 +8,7 @@ OpenERP Contact Form """, 'author': 'OpenERP SA', - 'depends': ['website', 'hr', 'hr_recruitment'], + 'depends': ['website', 'hr', 'hr_recruitment', 'website_mail'], 'data': [ 'views/website_hr_recruitment.xml', 'security/website_hr_recruitment_security.xml', diff --git a/addons/website_hr_recruitment/controllers/main.py b/addons/website_hr_recruitment/controllers/main.py index 45af8397e44..cafd4a61dd7 100644 --- a/addons/website_hr_recruitment/controllers/main.py +++ b/addons/website_hr_recruitment/controllers/main.py @@ -63,26 +63,6 @@ class website_hr_recruitment(http.Controller): }) return website.render("website_hr_recruitment.thankyou", values) - @http.route('/recruitment/published', type='json', auth="admin") - def published (self, **post): - hr_job = request.registry['hr.job'] - id = int(post['id']) - rec = hr_job.browse(request.cr, request.uid, id) - vals = {} - - vals['website_published'] = not rec.website_published - if vals['website_published']: - vals['state'] = 'recruit' - if rec.no_of_recruitment == 0.0: - vals ['no_of_recruitment'] = 1.0 - else: - vals['state'] = 'open' - vals ['no_of_recruitment'] = 0.0 - - res = hr_job.write(request.cr, request.uid, [rec.id], vals) - obj = hr_job.browse(request.cr, request.uid, id) - return { 'published': obj.website_published and "1" or "0", 'count': obj.no_of_recruitment } - @http.route('/recruitment/message_get_subscribed', type='json', auth="admin") def message_get_subscribed(self, email, id): id = int(id) diff --git a/addons/website_hr_recruitment/static/src/js/recruitment.js b/addons/website_hr_recruitment/static/src/js/recruitment.js index 54704ba3562..3dc33416c70 100644 --- a/addons/website_hr_recruitment/static/src/js/recruitment.js +++ b/addons/website_hr_recruitment/static/src/js/recruitment.js @@ -3,7 +3,7 @@ $(function () { div = $(this).parent(); parent = $(this).parent().parent(); id = $(this).parent().parent().attr('id'); - email = $(this).siblings('input[name=email]').val(); + email = $(this).siblings('div').find('input[name=email]').val(); openerp.jsonRpc('/recruitment/message_get_subscribed', 'call', {'email': email, 'id': id}).then(function (result) { if (result == 1) { div.hide(); @@ -23,46 +23,4 @@ $(function () { } }); }); - $(document).on('click', '.js_published, .js_unpublished', function (e) { - e.preventDefault(); - var $link = $(this).parent(); - $link.find('.js_published, .js_unpublished').addClass("hidden"); - var $unp = $link.find(".js_unpublished"); - var $p = $link.find(".js_published"); - openerp.jsonRpc('/recruitment/published', 'call', {'id': $link.data('id'), 'object': $link.data('object')}).then(function (result) { - if (+result['published']) { - $p.addClass("hidden"); - $unp.removeClass("hidden"); - $('tr[id='+$link.data('id')+']').find('span#norecruit').addClass("hidden"); - $('tr[id='+$link.data('id')+']').find('span#counting').removeClass("hidden"); - if ($.trim($('tr[id='+$link.data('id')+']').find('span#counting').html()).length == 0) { - htmlcon = ' No.of Post: ' + result['count'] + ''; - $('tr[id='+$link.data('id')+']').find('span#counting').html(htmlcon); - } else { - $('tr[id='+$link.data('id')+']').find('span#counting').find('span#counting_num').html(result['count']); - } - $('tr[id='+$link.data('id')+']').find('div[id='+$link.data('id')+']').addClass('hidden'); - } else { - $p.removeClass("hidden"); - $unp.addClass("hidden"); - $('tr[id='+$link.data('id')+']').find('span#counting').addClass("hidden"); - $('tr[id='+$link.data('id')+']').find('span#norecruit').removeClass("hidden"); - if ($.trim($('tr[id='+$link.data('id')+']').find('span#norecruit').html()).length == 0) { - $('tr[id='+$link.data('id')+']').find('span#norecruit').html("Right now no recruitment is going on.") - } - $('tr[id='+$link.data('id')+']').find('div[id='+$link.data('id')+']').removeClass('hidden'); - if ($.trim($('tr[id='+$link.data('id')+']').find('div[id='+$link.data('id')+']').html()).length == 0) { - htmlcon = "