2013-08-19 14:28:12 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2013-09-24 14:54:45 +00:00
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
2013-08-19 14:28:12 +00:00
|
|
|
|
|
|
|
from openerp.addons.web import http
|
|
|
|
from openerp.addons.web.http import request
|
2013-09-24 14:54:45 +00:00
|
|
|
from openerp.osv import osv
|
2013-08-19 14:28:12 +00:00
|
|
|
|
2013-08-21 08:52:46 +00:00
|
|
|
|
2013-09-24 14:54:45 +00:00
|
|
|
class Website(osv.Model):
|
2013-08-21 08:52:46 +00:00
|
|
|
_inherit = "website"
|
2013-09-24 14:54:45 +00:00
|
|
|
|
2013-11-07 15:14:00 +00:00
|
|
|
def preprocess_request(self, cr, uid, ids, request, context=None):
|
2013-08-21 08:52:46 +00:00
|
|
|
project_obj = request.registry['project.project']
|
2013-09-10 13:41:33 +00:00
|
|
|
project_ids = project_obj.search(cr, uid, [('privacy_visibility', "=", "public")], context=request.context)
|
|
|
|
|
2014-01-29 16:08:39 +00:00
|
|
|
request.context.update({
|
|
|
|
'website_project_ids': project_obj.browse(cr, uid, project_ids, context=request.context)
|
|
|
|
})
|
2013-09-10 13:41:33 +00:00
|
|
|
|
2014-01-29 16:08:39 +00:00
|
|
|
return super(Website, self).preprocess_request(cr, uid, ids, request, context=None)
|
2013-08-21 08:52:46 +00:00
|
|
|
|
|
|
|
|
2013-08-19 14:28:12 +00:00
|
|
|
class website_project(http.Controller):
|
|
|
|
|
2014-03-14 16:23:46 +00:00
|
|
|
@http.route(['/project/<model("project.project"):project>'], type='http', auth="public", website=True, multilang=True)
|
2014-01-28 16:53:40 +00:00
|
|
|
def project(self, project=None, **post):
|
2013-09-24 14:54:45 +00:00
|
|
|
cr, uid, context = request.cr, request.uid, request.context
|
|
|
|
render_values = {
|
2013-10-18 13:59:26 +00:00
|
|
|
'project': project,
|
|
|
|
'main_object': project,
|
2013-09-24 14:54:45 +00:00
|
|
|
}
|
|
|
|
return request.website.render("website_project.index", render_values)
|