Skip to Content
Menu
This question has been flagged

controller.py

from openerp import SUPERUSER_ID

from openerp.addons.web

import http

rom openerp.http import request

class WebsiteDemo(http.Controller):

   @http.route('/employee', type='http', auth='user', website=True)

    def display_employee_data(self):

       cr, context, pool = request.cr, request.context, request.registry

       hr_employee = pool.get('hr.employee')

       hr_employee_ids = hr_employee.search(cr, SUPERUSER_ID, [], context=context)

       hr_employee_data = hr_employee.browse(cr, SUPERUSER_ID, hr_employee_ids, context=context)

       values = { 'employees' : hr_employee_data }

       return request.website.render("website.employee", values)

log output :


.../controllers.py", line 19, in display_employee_data return request.website.render("website.employee", values) File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 338, in __getattr__ return getattr(self._get_current_object(), name)AttributeError: 'HttpRequest' object has no attribute 'website'

Avatar
Discard
Author

solved.

error in my code : remove "website" a

request.render("website.employee", values) Not request.website.render("website.employee", values)

Related Posts Replies Views Activity
2
Jul 24
2938
3
Apr 24
2531
0
Sep 21
895
2
Nov 16
5723
1
Mar 15
3642