Skip to content

Commit

Permalink
Merge pull request #740 from Ommo73/8.0-project_task_subtask
Browse files Browse the repository at this point in the history
8.0 project task subtask
  • Loading branch information
Ivan Yelizariev committed May 20, 2019
2 parents 91359cc + f2ebbca commit bba613a
Show file tree
Hide file tree
Showing 21 changed files with 98 additions and 85 deletions.
12 changes: 7 additions & 5 deletions project_task_subtask/README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
=======================
Project Task Checklist
=======================
=========================
Project Task To-Do List
=========================

Use subtasks to control your tasks. Be ensure that all your tasks/subtasks are performed and not missed.

Features:

* Added new "Checklist" tab on task's form
* Added new "To-Do List" tab on task's form
* When new subtask is created\changed, message is sent to user that assigned to this subtask
* Only users related to subtask can change subtask parameters
* All subtasks have a certain color, informing about their state
Expand All @@ -16,11 +16,13 @@ Features:
* TODO
* CANCELLED

* Added new "Checklist" menu
* Added new "To-Do List" menu

* default filter: "My", "TODO"
* optional group by: "Project", "Task", "User", "State"

* Added group "Allow edit others tasks"

Credits
=======

Expand Down
1 change: 1 addition & 0 deletions project_task_subtask/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from . import models

13 changes: 8 additions & 5 deletions project_task_subtask/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
{
"name": """Project Task Checklist""",
"summary": """Use checklist to be ensure that all your tasks are performed and to make easy control over them""",
"name": """Project Task To-Do List""",
"summary": """Use To-Do List to be ensure that all your tasks are performed and to make easy control over them""",
"category": """Project Management""",
"images": ['images/checklist_main.png'],
"version": "1.0.0",
"images": ['images/todolist_main.png'],
"version": "8.0.1.1.0",
"application": False,

"author": "IT-Projects LLC, Manaev Rafael",
"support": "apps@it-projects.info",
"website": "https://it-projects.info",
"license": "GPL-3",
"license": "LGPL-3",
"price": 69.00,
"currency": "EUR",

Expand Down
13 changes: 8 additions & 5 deletions project_task_subtask/data/subscription_template.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2017 manawi <https://github.com/manawi>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). -->
<openerp>
<data>
<record id="subtasks_subtype" model="mail.message.subtype">
<field name="name">All checklist updates</field>
<field name="name">All To-Do List updates</field>
<field name="res_model">project.task</field>
<field name="description">Subscribe to checklist updates of other users. By default you are notified on checklist items to and from you only.</field>
<field name="description">Subscribe to To-Do List updates of other users. By default you are notified on To-Do List items to and from you only.</field>
<field name="default" eval="False"/>
</record>

<record id="all_subtask_subtype" model="mail.message.subtype">
<field name="name">All checklist updates</field>
<field name="description">Subscribe to checklist updates of other users. By default you are notified on checklist items to and from you only.</field>
<field name="name">All To-Do List updates</field>
<field name="description">Subscribe to To-Do List updates of other users. By default you are notified on To-Do List items to and from you only.</field>
<field name="sequence">10</field>
<field name="res_model">project.project</field>
<field name="parent_id" eval="ref('subtasks_subtype')"/>
Expand Down
7 changes: 7 additions & 0 deletions project_task_subtask/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@

`1.1.0`
-------

- **Improvement**: 'Checklist' replaced by 'To-Do List'
- **New**: added group "Allow edit others tasks"

`1.0.0`
-------

Expand Down
10 changes: 5 additions & 5 deletions project_task_subtask/doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
========================
Project Task Checklist
========================
=========================
Project Task To-Do List
=========================

Installation
============
Expand All @@ -16,7 +16,7 @@ Example of usage:
* Create User1 and User2 in the ``Settings >> Users`` menu
* Login as User1

* Go to ``Project >> Project >> Tasks`` and open the ``Checklist`` tab
* Go to ``Project >> Project >> Tasks`` and open the ``To-Do List`` tab
* Create new subtask (Reviewer - User1, Assigned to - User2)

* Login as User2
Expand All @@ -26,5 +26,5 @@ Example of usage:
* You can see a message in Inbox "Cancelled: subtask_name" or "Done: subtask_name" accordingly.

* You can see your TODOs on tasks in kanban view in the ``Project >> Project >> Tasks`` menu
* The ``Project >> Project >> Checklist`` menu displays ALL subtasks in state TODO assigned to you and subtasks where you are Reviewer
* The ``Project >> Project >> To-Do List`` menu displays ALL subtasks in state TODO assigned to you and subtasks where you are Reviewer

1 change: 1 addition & 0 deletions project_task_subtask/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from . import project_task_subtask

42 changes: 29 additions & 13 deletions project_task_subtask/models/project_task_subtask.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-

# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2017 manawi <https://github.com/manawi>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from openerp import models, fields, api
from openerp.tools import html_escape as escape
from openerp.exceptions import Warning as UserError
Expand Down Expand Up @@ -34,8 +38,13 @@ def _compute_recolor(self):

@api.multi
def _compute_hide_button(self):
group = self.env.ref('project_task_subtask.project_subtask_rule')
for record in self:
if self.env.user not in [record.reviewer_id, record.user_id]:
if self.env.user in [record.reviewer_id, record.user_id]:
record.hide_button = False
elif group in self.env.user.groups_id:
record.hide_button = False
else:
record.hide_button = True

@api.multi
Expand All @@ -53,17 +62,20 @@ def _needaction_domain_get(self):
def write(self, vals):
old_names = dict(zip(self.mapped('id'), self.mapped('name')))
result = super(ProjectTaskSubtask, self).write(vals)
for r in self:
group = self.env.ref('project_task_subtask.project_subtask_rule')
for subtask in self:
if vals.get('state'):
r.task_id.send_subtask_email(r.name, r.state, r.reviewer_id.id, r.user_id.id)
if self.env.user != r.reviewer_id and self.env.user != r.user_id:
raise UserError(_('Only users related to that subtask can change state.'))
subtask.task_id.send_subtask_email(subtask.name, subtask.state, subtask.reviewer_id.id, subtask.user_id.id)
if self.env.user != subtask.reviewer_id and self.env.user != subtask.user_id and group not in self.env.user.groups_id:
raise UserError(_('Only users related to that subtask or users with special rights can change state.'))
if vals.get('name'):
r.task_id.send_subtask_email(r.name, r.state, r.reviewer_id.id, r.user_id.id, old_name=old_names[r.id])
if self.env.user != r.reviewer_id and self.env.user != r.user_id:
raise UserError(_('Only users related to that subtask can change state.'))
subtask.task_id.send_subtask_email(subtask.name, subtask.state, subtask.reviewer_id.id, subtask.user_id.id, old_name=old_names[subtask.id])
if self.env.user != subtask.reviewer_id and self.env.user != subtask.user_id and group not in self.env.user.groups_id:
raise UserError(_('Only users related to that subtask or users with special rights can change state.'))
if vals.get('user_id'):
r.task_id.send_subtask_email(r.name, r.state, r.reviewer_id.id, r.user_id.id)
subtask.task_id.send_subtask_email(subtask.name, subtask.state, subtask.reviewer_id.id, subtask.user_id.id)
if self.env.user != subtask.reviewer_id and group not in self.env.user.groups_id:
raise UserError(_('Only reviewer of this subtask or users with special rights can change executor.'))
return result

@api.model
Expand Down Expand Up @@ -164,11 +176,15 @@ def send_subtask_email(self, subtask_name, subtask_state, subtask_reviewer_id, s
body = '<p>' + escape(user.name) + ', <br><strong>' + state + '</strong>: ' + escape(subtask_name)
partner_ids = [user.partner_id.id]
elif self.env.user == user:
body = '<p>' + escape(reviewer.name) + ', <em style="color:#999">I updated checklist item assigned to me:</em> <br><strong>' + state + '</strong>: ' + escape(subtask_name)
body = '<p>' + escape(reviewer.name) + ', <em style="color:#999">I updated To-Do List item assigned to me:</em> <br><strong>' + state + '</strong>: ' + escape(subtask_name)
partner_ids = [reviewer.partner_id.id]
else:
body = '<p>' + escape(user.name) + ', ' + escape(reviewer.name) + ', <em style="color:#999">I updated checklist item, now its assigned to ' + escape(user.name) + ': </em> <br><strong>' + state + '</strong>: ' + escape(subtask_name)
partner_ids = [user.partner_id.id, reviewer.partner_id.id]
if user.id == reviewer.id:
body = '<p>' + escape(reviewer.name) + ', <em style="color:#999">I updated Subtask assigned to ' + escape(user.name) + ': </em> <br><strong>' + state + '</strong>: ' + escape(subtask_name)
partner_ids = [user.partner_id.id]
else:
body = '<p>' + escape(reviewer.name) + ', ' + escape(user.name) + ', <em style="color:#999">I updated Subtask assigned to ' + escape(user.name) + ': </em> <br><strong>' + state + '</strong>: ' + escape(subtask_name)
partner_ids = [user.partner_id.id, reviewer.partner_id.id]
if old_name:
body = body + '<br><em style="color:#999">Updated from</em><br><strong>' + state + '</strong>: ' + escape(old_name) + '</p>'
else:
Expand Down
1 change: 0 additions & 1 deletion project_task_subtask/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_task_subtask,project.task.subtask,model_project_task_subtask,project.group_project_user,1,1,1,0

41 changes: 9 additions & 32 deletions project_task_subtask/security/project_security.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). -->
<openerp>
<data>

<!-- <record model="ir.rule" id="project_description_subtask_rule"> -->
<!-- <field name="name">Project: only reviewer can change description</field> -->
<!-- <field name="model_id" ref="project_task_subtask.model_project_task_subtask"/> -->
<!-- <field name="groups" eval="[(4,ref('project.group_project_user'))]"/> -->
<!-- <field name="domain_force">[ -->
<!-- ('reviewer_id', '=', user.id), -->
<!-- ]</field> -->
<!-- <field name="perm_unlink" eval="False"/> -->
<!-- <field name="perm_write" eval="True"/> -->
<!-- <field name="perm_create" eval="False"/> -->
<!-- <field name="perm_read" eval="False"/> -->
<!-- </record> -->

<!-- <record id="delete_not_todo_only" model="ir.rule"> -->
<!-- <field name="name">Only cancelled and done subtasks may be deleted by reviewer</field> -->
<!-- <field name="model_id" ref="project_task_subtask.model_project_task_subtask"/> -->
<!-- <field name="groups" eval="[(4, ref('base.group_sale_manager'))]"/> -->
<!-- <field name="perm_read" eval="0"/> -->
<!-- <field name="perm_write" eval="0"/> -->
<!-- <field name="perm_create" eval="0"/> -->
<!-- <field name="perm_unlink" eval="1" /> -->
<!-- <field name="domain_force">[('state','!=','todo')]</field> -->
<!-- </record> -->
<data noupdate="1">

<!-- <record id="delete_not_todo_only" model="ir.rule"> -->
<!-- <field name="name">Only cancelled and done subtasks may be deleted by reviewer</field> -->
<!-- <field name="model_id" ref="project_task_subtask.model_project_task_subtask"/> -->
<!-- <field name="groups" eval="[(4, ref('base.group_sale_manager'))]"/> -->
<!-- <field name="domain_force">[('uid','!=','reviewer_id')]</field> -->
<!-- </record> -->
<record id="project_subtask_rule" model="res.groups">
<field name="name">Allow edit others tasks</field>
<field name="category_id" ref="base.module_category_usability"/>
<field name="comment">The user will have access to edit others tasks.</field>
</record>

</data>
</openerp>
Binary file not shown.
Binary file not shown.
Binary file not shown.
28 changes: 14 additions & 14 deletions project_task_subtask/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan" style="color:#875A7B;">Project Task Checklist</h2>
<h3 class="oe_slogan">Use checklist to be ensure that all your tasks are performed and to make easy control over them</h3>
<h2 class="oe_slogan" style="color:#875A7B;">Project Task To-Do List</h2>
<h3 class="oe_slogan">Use To-Do List to be ensure that all your tasks are performed and to make easy control over them</h3>
</div>
</div>
</section>
Expand All @@ -16,15 +16,15 @@ <h3 class="oe_slogan">Use checklist to be ensure that all your tasks are perform
<ul class="list-unstyled">
<li>
<i class="fa fa-check-square-o text-primary"></i>
create checklist for any tasks
create To-Do List for any tasks
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
track all subtasks that should be done and keep them under control
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
checklist items will be colored depending on their state
To-Do List items will be colored depending on their state
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
Expand All @@ -46,13 +46,13 @@ <h3 class="oe_slogan">Use checklist to be ensure that all your tasks are perform
<h3 class="oe_slogan">How It Works</h3>
<div class="oe_span12" >
<p class="oe_mt32">
Go to <em>Project &rarr; Tasks</em> menu and create/open a task. Here you can see new "Checklist" tab.
Add items (hereinafter "subtasks") into your checklist. <br/>
Go to <em>Project &rarr; Tasks</em> menu and create/open a task. Here you can see new "To-Do List" tab.
Add items (hereinafter "subtasks") into your To-Do List. <br/>
Specify <em>"Description"</em> and select <em>"Assigned to"</em>, <em>"Reviewer"</em>.
</p>
</div>
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="checklist.png"/>
<img class="oe_demo oe_picture oe_screenshot" src="todolist.png"/>
</div>
</div>
</section>
Expand All @@ -68,11 +68,11 @@ <h3 class="oe_slogan">How It Works</h3>
</ul>
</p>
<p>
If you mistakenly switch state to "DONE" or "CANCELLED", you will be able to revert state to TODO by clicking on <img src="checklist_icon.png">
If you mistakenly switch state to "DONE" or "CANCELLED", you will be able to revert state to TODO by clicking on <img src="todolist_icon.png">
</p>
</div>
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="checklist_color.png"/>
<img class="oe_demo oe_picture oe_screenshot" src="todolist_color.png"/>
</div>
</div>
</section>
Expand All @@ -81,11 +81,11 @@ <h3 class="oe_slogan">How It Works</h3>
<div class="oe_row oe_spaced">
<div class="oe_span12 text-center">
<p class="oe_mt32">
All checklist changes and updates are tracked on task mail thread and you will receive instant email notifications to your Inbox
All To-Do List changes and updates are tracked on task mail thread and you will receive instant email notifications to your Inbox
</p>
</div>
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="checklist_mail.png"/>
<img class="oe_demo oe_picture oe_screenshot" src="todolist_mail.png"/>
</div>
</div>
</section>
Expand All @@ -98,7 +98,7 @@ <h3 class="oe_slogan">How It Works</h3>
</p>
</div>
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="checklist_kanban.png"/>
<img class="oe_demo oe_picture oe_screenshot" src="todolist_kanban.png"/>
</div>
</div>
</section>
Expand All @@ -107,11 +107,11 @@ <h3 class="oe_slogan">How It Works</h3>
<div class="oe_row oe_spaced">
<div class="oe_span12 text-center">
<p class="oe_mt32">
Track all your TODOs in one place and keep them under control. Go to the <em>Project &rarr; Checklist</em> menu to see them.
Track all your TODOs in one place and keep them under control. Go to the <em>Project &rarr; To-Do List</em> menu to see them.
</p>
</div>
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="checklist_menu.png"/>
<img class="oe_demo oe_picture oe_screenshot" src="todolist_menu.png"/>
</div>
</div>
</section>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bba613a

Please sign in to comment.