summaryrefslogtreecommitdiff
path: root/addons/website_project
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@openerp.com>2013-08-21 10:52:46 +0200
committerChristophe Matthieu <chm@openerp.com>2013-08-21 10:52:46 +0200
commit1df99b04829f396e4fd8aec48b6814f5366bcdf2 (patch)
tree97e883f655aa6f60f377417dbb34bda48bbd7701 /addons/website_project
parentae8630a73522a51c462fdc613b21d13d7fc2ac35 (diff)
[IMP] website_project: display table of task by stage
bzr revid: chm@openerp.com-20130821085246-721xkh5bji0vqi9q
Diffstat (limited to 'addons/website_project')
-rw-r--r--addons/website_project/controllers/main.py35
-rw-r--r--addons/website_project/views/website_project.xml46
2 files changed, 66 insertions, 15 deletions
diff --git a/addons/website_project/controllers/main.py b/addons/website_project/controllers/main.py
index d79bd786a3f..b2eba78720e 100644
--- a/addons/website_project/controllers/main.py
+++ b/addons/website_project/controllers/main.py
@@ -1,16 +1,43 @@
# -*- coding: utf-8 -*-
+from openerp.osv import osv
from openerp.addons.web import http
from openerp.addons.web.http import request
+
+class website(osv.osv):
+ _inherit = "website"
+ def get_rendering_context(self, additional_values=None):
+ project_obj = request.registry['project.project']
+ project_ids = project_obj.search(request.cr, request.uid, [('privacy_visibility', "=", "public")])
+ values = {
+ 'project_ids': project_obj.browse(request.cr, request.uid, project_ids),
+ }
+ if additional_values:
+ values.update(additional_values)
+ return super(website, self).get_rendering_context(values)
+
+
class website_project(http.Controller):
- @http.route(['/projects/'], type='http', auth="public")
- def blog(self, **post):
+ @http.route(['/project/<int:project_id>/'], type='http', auth="public")
+ def blog(self, project_id=None, **post):
website = request.registry['website']
project_obj = request.registry['project.project']
- project_ids = project_obj.search(request.cr, request.uid, [('privacy_visibility', "=", "public")])
+ task_obj = request.registry['project.task']
+ stage_obj = request.registry['project.task.type']
+
+ project = project_obj.browse(request.cr, request.uid, project_id)
+
+ domain = [('id', 'in', [task.id for task in project.tasks])]
+ stages = task_obj.read_group(request.cr, request.uid, domain, ["id", "stage_id"], groupby="stage_id")
+ for stage in stages:
+ stage['stage_id'] = stage_obj.browse(request.cr, request.uid, stage['stage_id'][0])
+ task_ids = task_obj.search(request.cr, request.uid, stage['__domain'])
+ stage['task_ids'] = task_obj.browse(request.cr, request.uid, task_ids)
+
values = website.get_rendering_context({
- 'project_ids': project_obj.browse(request.cr, request.uid, project_ids)
+ 'project_id': project,
+ 'stages': stages,
})
return website.render("website_project.index", values)
diff --git a/addons/website_project/views/website_project.xml b/addons/website_project/views/website_project.xml
index 36e93f56413..3864eb8256a 100644
--- a/addons/website_project/views/website_project.xml
+++ b/addons/website_project/views/website_project.xml
@@ -6,27 +6,51 @@
<!-- Layout add nav and footer -->
<template id="footer_custom" inherit_id="website.layout" name="Custom Footer">
- <xpath expr="//body/header//ul[@id='top_menu']/li[last()]" position="before">
- <li><a href="/projects/">Projects</a></li>
+ <xpath expr="//body/footer//div[@name='info']/ul" position="inside">
+ <li t-foreach="project_ids" t-as="project_id"><a t-attf-href="/project/#{ project_id.id }/"><t t-esc="project_id.name"/></a></li>
</xpath>
</template>
<!-- Page -->
- <template id="index" name="Projects">
+ <template id="index" name="Project">
<t t-call="website.layout">
- <t t-set="title">Projects</t>
+ <t t-set="title">Project</t>
<div class="container">
- <div t-foreach="project_ids" t-as="project_id">
- <h4 t-field="project_id.name"/>
- <div t-foreach="project_id.tasks" t-as="task">
- <a t-attf-href="/admin#view_type=form&amp;model=project.task&amp;id=#{task.id}"><span t-field="task.name"/></a>
- </div>
- </div>
+ <h4 t-field="project_id.name"/>
+ <table class="table">
+ <thead>
+ <tr>
+ <th t-foreach="stages" t-as="stage">
+ <span t-field="stage_id.name"/>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td t-foreach="stages" t-as="stage">
+ <div t-foreach="task_ids" t-as="task_id" class="thumbnail">
+ <a t-attf-href="/task/#{ task_id.id }/"><span t-field="task_id.name"/></a>
+ <div>
+ Assigned to <span t-field="task_id.user_id"/>
+ </div>
+ <div>
+ <span t-foreach="task_id.categ_ids" t-as="categ_id" class="label">
+ <t t-esc="categ_id.name"/>
+ </span>
+ </div>
+ <small>
+ <i class="icon-time"></i> <span t-field="task_id.date_start"/><br/>
+ <t t-if="task_id.date_end">Ending Date: <span t-field="task_id.date_end"/></t>
+ </small>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
</t>
</template>
-
</data>
</openerp>