Files
odoo_source/addons/website_hr/controllers/main.py
T
Nicolas Lempereur 068071cf9a [FIX] website_hr: add published for hr.employee
Previously, we could unpublish an employee from the website, but there
was no simple way to publish it again after we leave the page.

This fix show the unpublished employees on the about us page for the
users who can modify these employees records.

closes #6416
opw-633462
2015-04-27 12:57:35 +02:00

20 lines
808 B
Python

# -*- coding: utf-8 -*-
from openerp import http
from openerp.http import request
class website_hr(http.Controller):
@http.route(['/page/website.aboutus', '/page/aboutus'], type='http', auth="public", website=True)
def blog(self, **post):
hr_obj = request.registry['hr.employee']
domain = []
if not hr_obj.check_access_rights(request.cr, request.uid, 'write', raise_exception=False):
domain.append(('website_published', '=', True))
employee_ids = hr_obj.search(request.cr, request.uid, domain, context=request.context)
values = {
'employee_ids': hr_obj.browse(request.cr, request.uid, employee_ids,
request.context)
}
return request.website.render("website.aboutus", values)