[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
This commit is contained in:
Nicolas Lempereur 2015-04-22 09:33:12 +02:00
parent 675fd554f1
commit 068071cf9a
1 changed files with 4 additions and 2 deletions

View File

@ -8,8 +8,10 @@ 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']
employee_ids = hr_obj.search(request.cr, request.uid, [('website_published', '=', True)],
context=request.context)
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)