2018-01-16 06:58:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-16 11:34:37 +01:00
|
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
from werkzeug import urls
|
|
|
|
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra import api, fields, models
|
|
|
|
from flectra.tools.translate import html_translate
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class RecruitmentSource(models.Model):
|
|
|
|
_inherit = 'hr.recruitment.source'
|
|
|
|
|
|
|
|
url = fields.Char(compute='_compute_url', string='Url Parameters')
|
|
|
|
|
|
|
|
@api.one
|
|
|
|
@api.depends('source_id', 'source_id.name', 'job_id')
|
|
|
|
def _compute_url(self):
|
|
|
|
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
|
|
|
for source in self:
|
|
|
|
source.url = urls.url_join(base_url, "%s?%s" % (source.job_id.website_url,
|
|
|
|
urls.url_encode({
|
|
|
|
'utm_campaign': self.env.ref('hr_recruitment.utm_campaign_job').name,
|
|
|
|
'utm_medium': self.env.ref('utm.utm_medium_website').name,
|
|
|
|
'utm_source': source.source_id.name
|
|
|
|
})
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
class Applicant(models.Model):
|
|
|
|
|
|
|
|
_inherit = 'hr.applicant'
|
[IMP] Improve Multi-Website Functionalities:-
- Affected Modules:
website_sale, website_blog, website_partner, website_crm_partner_assign,
website_customer, website_slides, website_links, website_membership,
website_hr, website_hr_recruitment, website_payment, website_sale_delivery,
website_forum, website_event
- Remove unnecessary model `website.product.pricelist` from website_sale,
All its mechanism already transferd to existing model `product.pricelist`
- Change in `product.pricelist` model, make website_id(o2m) to website_ids(m2m),
As user can choose that same pricelist can be used in multiple websites
- Added `default_website` as default values in `website_ids(m2m)` & `website_id(m2o)` field in
almost all affected modules (mentioned above!!)
- To use/publish things(like... product, pricelist, blog, forum, events, etc...) in website,
User have to set `website_published` mechanism `on` (if it's available for that model/object),
Also have to set/assign different websites in `website_ids` field as per needs
2018-02-06 10:43:31 +01:00
|
|
|
|
2018-01-01 12:57:36 +01:00
|
|
|
website_id = fields.Many2one('website', string="Website")
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
def website_form_input_filter(self, request, values):
|
|
|
|
if 'partner_name' in values:
|
|
|
|
values.setdefault('name', '%s\'s Application' % values['partner_name'])
|
|
|
|
return values
|
|
|
|
|
|
|
|
|
|
|
|
class Job(models.Model):
|
|
|
|
|
|
|
|
_name = 'hr.job'
|
|
|
|
_inherit = ['hr.job', 'website.seo.metadata', 'website.published.mixin']
|
|
|
|
|
|
|
|
def _get_default_website_description(self):
|
|
|
|
default_description = self.env["ir.model.data"].xmlid_to_object("website_hr_recruitment.default_website_description")
|
|
|
|
return (default_description.render() if default_description else "")
|
|
|
|
|
[IMP] Improve Multi-Website Functionalities:-
- Affected Modules:
website_sale, website_blog, website_partner, website_crm_partner_assign,
website_customer, website_slides, website_links, website_membership,
website_hr, website_hr_recruitment, website_payment, website_sale_delivery,
website_forum, website_event
- Remove unnecessary model `website.product.pricelist` from website_sale,
All its mechanism already transferd to existing model `product.pricelist`
- Change in `product.pricelist` model, make website_id(o2m) to website_ids(m2m),
As user can choose that same pricelist can be used in multiple websites
- Added `default_website` as default values in `website_ids(m2m)` & `website_id(m2o)` field in
almost all affected modules (mentioned above!!)
- To use/publish things(like... product, pricelist, blog, forum, events, etc...) in website,
User have to set `website_published` mechanism `on` (if it's available for that model/object),
Also have to set/assign different websites in `website_ids` field as per needs
2018-02-06 10:43:31 +01:00
|
|
|
def _default_website(self):
|
|
|
|
default_website_id = self.env.ref('website.default_website')
|
|
|
|
return [default_website_id.id] if default_website_id else None
|
|
|
|
|
2018-01-16 06:58:15 +01:00
|
|
|
website_description = fields.Html('Website description', translate=html_translate, sanitize_attributes=False, default=_get_default_website_description)
|
2018-01-01 12:57:36 +01:00
|
|
|
website_ids = fields.Many2many('website', 'website_hr_job_pub_rel',
|
|
|
|
'website_id', 'job_id',
|
[IMP] Improve Multi-Website Functionalities:-
- Affected Modules:
website_sale, website_blog, website_partner, website_crm_partner_assign,
website_customer, website_slides, website_links, website_membership,
website_hr, website_hr_recruitment, website_payment, website_sale_delivery,
website_forum, website_event
- Remove unnecessary model `website.product.pricelist` from website_sale,
All its mechanism already transferd to existing model `product.pricelist`
- Change in `product.pricelist` model, make website_id(o2m) to website_ids(m2m),
As user can choose that same pricelist can be used in multiple websites
- Added `default_website` as default values in `website_ids(m2m)` & `website_id(m2o)` field in
almost all affected modules (mentioned above!!)
- To use/publish things(like... product, pricelist, blog, forum, events, etc...) in website,
User have to set `website_published` mechanism `on` (if it's available for that model/object),
Also have to set/assign different websites in `website_ids` field as per needs
2018-02-06 10:43:31 +01:00
|
|
|
default=_default_website,
|
2018-01-01 12:57:36 +01:00
|
|
|
string='Websites', copy=False,
|
[IMP] Improve Multi-Website Functionalities:-
- Affected Modules:
website_sale, website_blog, website_partner, website_crm_partner_assign,
website_customer, website_slides, website_links, website_membership,
website_hr, website_hr_recruitment, website_payment, website_sale_delivery,
website_forum, website_event
- Remove unnecessary model `website.product.pricelist` from website_sale,
All its mechanism already transferd to existing model `product.pricelist`
- Change in `product.pricelist` model, make website_id(o2m) to website_ids(m2m),
As user can choose that same pricelist can be used in multiple websites
- Added `default_website` as default values in `website_ids(m2m)` & `website_id(m2o)` field in
almost all affected modules (mentioned above!!)
- To use/publish things(like... product, pricelist, blog, forum, events, etc...) in website,
User have to set `website_published` mechanism `on` (if it's available for that model/object),
Also have to set/assign different websites in `website_ids` field as per needs
2018-02-06 10:43:31 +01:00
|
|
|
help='List of websites in which Job '
|
|
|
|
'will published.')
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
@api.multi
|
|
|
|
def _compute_website_url(self):
|
|
|
|
super(Job, self)._compute_website_url()
|
|
|
|
for job in self:
|
|
|
|
job.website_url = "/jobs/detail/%s" % job.id
|
|
|
|
|
|
|
|
@api.multi
|
|
|
|
def set_open(self):
|
|
|
|
self.write({'website_published': False})
|
|
|
|
return super(Job, self).set_open()
|