[IMP] website_hr_recruitment compatible with Multi-Website

This commit is contained in:
Kaushal Prajapati 2018-01-01 17:27:36 +05:30 committed by Siddharth Bhalgami
parent 1ef704567a
commit a36dee77a6
4 changed files with 11 additions and 0 deletions

View File

@ -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)

View File

@ -32,6 +32,7 @@
'partner_phone',
'job_id',
'department_id',
'website_id',
]"/>
</function>
</data>

View File

@ -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):

View File

@ -22,6 +22,9 @@
<field name="website_published" widget="website_button"/>
</button>
</div>
<xpath expr="//field[@name='address_id']" position="after">
<field name="website_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>
</flectra>