[FIX] website_hr_recruitment: frontend creation ok

When creating a job position from the frontend, and we:

- are on the same language that the default website language,
- have the permission to write on ir.ui.view,

we have all conditions to adding branding used to edit a page.

But when creating a position by the frontend, we create a job that will
render this template:

 website_hr_recruitment.default_website_description

When we are in the above said condition, we will create a job position
that erroneously has the branding that should only be displayed on
website and removed when saving an edition.

This caused a lot of problem with the editor that would most often not
be able to edit the content.

In this commit, we use the "rendering_bundle" context key to prevent
branding.

opw-1868879
closes #25963
This commit is contained in:
Nicolas Lempereur
2018-07-25 12:01:05 +02:00
parent a34789c837
commit f1ee633f26
@@ -69,7 +69,8 @@ class WebsiteHrRecruitment(http.Controller):
@http.route('/jobs/add', type='http', auth="user", website=True)
def jobs_add(self, **kwargs):
job = request.env['hr.job'].create({
# avoid branding of website_description by setting rendering_bundle in context
job = request.env['hr.job'].with_context(rendering_bundle=True).create({
'name': _('Job Title'),
})
return request.redirect("/jobs/detail/%s?enable_editor=1" % slug(job))