ADD security to project.task.line and show on website.

`website_project_task` module now includes optional template to display Todo List on the task view
This commit is contained in:
Jared Kipe
2018-11-03 16:26:49 -07:00
parent 2784c4823e
commit a13e6587c0
4 changed files with 27 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ Adds "todo" lines onto Project Tasks, and improves sub-tasks.
'project',
],
'data': [
'security/ir.model.access.csv',
'views/project_views.xml',
],
'installable': True,

View File

@@ -11,7 +11,11 @@ class ProjectTask(models.Model):
def _compute_subtask_count(self):
for task in self:
task.subtask_count = self.search_count([('id', 'child_of', task.id), ('id', '!=', task.id)])
task.subtask_count_done = self.search_count([('id', 'child_of', task.id), ('id', '!=', task.id), ('stage_id.fold', '=', True)])
if task.subtask_count:
task.subtask_count_done = self.search_count([('id', 'child_of', task.id), ('id', '!=', task.id),
('stage_id.fold', '=', True)])
else:
task.subtask_count_done = 0
class ProjectTaskLine(models.Model):

View File

@@ -0,0 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_project_task_line","access_project_task_line","model_project_task_line","base.group_user",1,1,1,1
"access_project_task_line_public","access_project_task_line public","model_project_task_line","base.group_public",1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_project_task_line access_project_task_line model_project_task_line base.group_user 1 1 1 1
3 access_project_task_line_public access_project_task_line public model_project_task_line base.group_public 1 0 0 0

View File

@@ -36,4 +36,22 @@
</xpath>
</template>
<template id="my_task_todo" inherit_id='project.portal_my_task' name="Todo List (requires project_task_line)" customize_show="True" active="False">
<xpath expr="//t[@t-if='task.description']" position="before">
<t t-if="task.line_ids">
<div class="col-md-12">
<strong>Todo List</strong>
<ul class="list-unstyled">
<li t-foreach="task.line_ids" t-as="line">
<span t-if="line.kanban_state == 'normal'" class="text-muted"><i class="fa fa-circle"></i></span>
<span t-if="line.kanban_state == 'done'" class="text-success"><i class="fa fa-check-circle"></i></span>
<span t-if="line.kanban_state == 'blocked'" class="text-danger"><i class="fa fa-times-circle"></i></span>
<span t-field="line.name"/>
</li>
</ul>
</div>
</t>
</xpath>
</template>
</odoo>