From a36dee77a6be08412fdf432efaf470693b6c0d46 Mon Sep 17 00:00:00 2001 From: Kaushal Prajapati Date: Mon, 1 Jan 2018 17:27:36 +0530 Subject: [PATCH] [IMP] website_hr_recruitment compatible with Multi-Website --- addons/website_hr_recruitment/controllers/main.py | 2 ++ addons/website_hr_recruitment/data/config_data.xml | 1 + addons/website_hr_recruitment/models/hr_recruitment.py | 5 +++++ addons/website_hr_recruitment/views/hr_recruitment_views.xml | 3 +++ 4 files changed, 11 insertions(+) diff --git a/addons/website_hr_recruitment/controllers/main.py b/addons/website_hr_recruitment/controllers/main.py index c13b1638..2814fb2f 100644 --- a/addons/website_hr_recruitment/controllers/main.py +++ b/addons/website_hr_recruitment/controllers/main.py @@ -29,6 +29,8 @@ class WebsiteHrRecruitment(http.Controller): # List jobs available to current UID job_ids = Jobs.search([], order="website_published desc,no_of_recruitment desc").ids + if not request.env['res.users'].has_group('website.group_website_publisher'): + job_ids = Jobs.search(['|',('website_ids', '=', False), ('website_ids', 'in', request.website.id)], order="website_published desc, no_of_recruitment desc").ids # Browse jobs as superuser, because address is restricted jobs = Jobs.sudo().browse(job_ids) diff --git a/addons/website_hr_recruitment/data/config_data.xml b/addons/website_hr_recruitment/data/config_data.xml index d4e0d6eb..5a28e243 100644 --- a/addons/website_hr_recruitment/data/config_data.xml +++ b/addons/website_hr_recruitment/data/config_data.xml @@ -32,6 +32,7 @@ 'partner_phone', 'job_id', 'department_id', + 'website_id', ]"/> diff --git a/addons/website_hr_recruitment/models/hr_recruitment.py b/addons/website_hr_recruitment/models/hr_recruitment.py index 8056b29d..91e16790 100644 --- a/addons/website_hr_recruitment/models/hr_recruitment.py +++ b/addons/website_hr_recruitment/models/hr_recruitment.py @@ -29,6 +29,7 @@ class RecruitmentSource(models.Model): class Applicant(models.Model): _inherit = 'hr.applicant' + website_id = fields.Many2one('website', string="Website") def website_form_input_filter(self, request, values): if 'partner_name' in values: @@ -46,6 +47,10 @@ class Job(models.Model): return (default_description.render() if default_description else "") website_description = fields.Html('Website description', translate=html_translate, sanitize_attributes=False, default=_get_default_website_description) + website_ids = fields.Many2many('website', 'website_hr_job_pub_rel', + 'website_id', 'job_id', + string='Websites', copy=False, + help='List of websites in which Job is published.') @api.multi def _compute_website_url(self): diff --git a/addons/website_hr_recruitment/views/hr_recruitment_views.xml b/addons/website_hr_recruitment/views/hr_recruitment_views.xml index ec9dec58..2d8e3bf9 100644 --- a/addons/website_hr_recruitment/views/hr_recruitment_views.xml +++ b/addons/website_hr_recruitment/views/hr_recruitment_views.xml @@ -22,6 +22,9 @@ + + + \ No newline at end of file