Skip to content
Permalink
Browse files

Merge pull request #726 from KolushovAlexandr/11.0-project_task_subta…

…sk-update_our

11.0 project task subtask update
  • Loading branch information...
yelizariev committed Feb 24, 2019
2 parents 7e05d65 + 7b6bba6 commit 8921d1e29b55ecf63bcc19a0f37b374e372b4478
@@ -1,3 +1,7 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3

=======================
Project Task Checklist
=======================
@@ -36,15 +40,25 @@ Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__

To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/project_task_subtask/>`__.

Thank you for understanding!

`IT-Projects Team <https://www.it-projects.info/team>`__

Further information
===================

Demo: http://runbot.it-projects.info/demo/misc-addons/8.0
Demo: http://runbot.it-projects.info/demo/misc-addons/11.0

HTML Description: https://apps.odoo.com/apps/modules/8.0/project_task_subtask/
HTML Description: https://apps.odoo.com/apps/modules/11.0/project_task_subtask/

Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Tested on Odoo 8.0 8ce1e5134037dfe6cfbd756813e9baa31a221958
Notifications on updates: `via Atom <https://github.com/it-projects-llc/misc-addons/commits/11.0/project_task_subtask.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/misc-addons/commits/11.0/project_task_subtask.atom>`_

Tested on Odoo 11.0 77e7d952b4c72d58c1b8f34b57e355f5b98c88b0
@@ -1,2 +1,3 @@
from . import models
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import models
@@ -1,9 +1,15 @@
# Copyright 2017-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2017-2018 manawi <https://github.com/manawi>
# Copyright 2017 Karamov Ilmir <https://it-projects.info/team/ilmir-k>
# Copyright 2017-2018 iledarn <https://github.com/iledarn>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (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""",
"category": """Project Management""",
"images": ['images/checklist_main.png'],
"version": "11.0.1.0.3",
"version": "11.0.1.1.0",
"application": False,

"author": "IT-Projects LLC, Manaev Rafael",
@@ -18,10 +24,12 @@
"data": [
'security/ir.model.access.csv',
'views/project_task_subtask.xml',
'views/assets.xml',
'data/subscription_template.xml',
'security/project_security.xml'
],
"qweb": [
'static/src/xml/templates.xml'
],
"demo": [
'demo/project_task_subtask_demo.xml'
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

<openerp>
<data>
<!--Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2017 Karamov Ilmir <https://it-projects.info/team/ilmir-k>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -->
<odoo>
<record id="subtasks_subtype" model="mail.message.subtype">
<field name="name">All checklist updates</field>
<field name="res_model">project.task</field>
@@ -18,5 +19,4 @@
<field name="relation_field">project_id</field>
<field name="default" eval="True"/>
</record>
</data>
</openerp>
</odoo>
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!--Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2017 manawi <https://github.com/manawi>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -->
<odoo noupdate="1">
<record id="project_task_subtask_1" model="project.task.subtask">
<field name="name">test subtask</field>
<field name="user_id" eval="ref('base.user_demo')"/>
<field name="task_id" eval="ref('project.project_task_1')"/>
</record>
</data>
</openerp>
</odoo>
@@ -1,3 +1,8 @@
`1.1.0`
-------

**Improvement:** Status bar on tasks for project.task kanban view
**Improvement:** Button to sort subtasks

`1.0.2`
-------
@@ -1,2 +1,3 @@
from . import project_task_subtask
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import project_task_subtask
@@ -1,3 +1,10 @@
# Copyright 2017-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2017-2018 manawi <https://github.com/manawi>
# Copyright 2017-2018 Karamov Ilmir <https://it-projects.info/team/ilmir-k>
# Copyright 2017-2018 iledarn <https://github.com/iledarn>
# Copyright 2017 Nicolas JEUDY <https://github.com/njeudy>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import models, fields, api
from odoo.tools import html_escape as escape
@@ -100,6 +107,8 @@ class Task(models.Model):
subtask_ids = fields.One2many('project.task.subtask', 'task_id', 'Subtask')
kanban_subtasks = fields.Text(compute='_compute_kanban_subtasks')
default_user = fields.Many2one('res.users', compute='_compute_default_user')
completion = fields.Integer('Completion', compute='_compute_completion')
completion_xml = fields.Text(compute='_compute_completion_xml')

@api.multi
def _compute_default_user(self):
@@ -117,28 +126,69 @@ def _compute_default_user(self):
@api.multi
def _compute_kanban_subtasks(self):
for record in self:
result_string1 = ''
result_string2 = ''
result_string3 = ''
for subtask in record.subtask_ids:
bounding_length = 25
tmp_list = (subtask.name).split()
for index in range(len(tmp_list)):
if len(tmp_list[index]) > bounding_length:
tmp_list[index] = tmp_list[index][:bounding_length] + '...'
tmp_subtask_name = " ".join(tmp_list)
if subtask.state == 'todo' and record.env.user == subtask.user_id and record.env.user == subtask.reviewer_id:
tmp_string3 = escape(': {0}'.format(tmp_subtask_name))
result_string3 += '<li><b>TODO</b>{}</li>'.format(tmp_string3)
elif subtask.state == 'todo' and record.env.user == subtask.user_id:
tmp_string1_1 = escape('{0}'.format(subtask.reviewer_id.name))
tmp_string1_2 = escape('{0}'.format(tmp_subtask_name))
result_string1 += '<li><b>TODO</b> from <em>{0}</em>: {1}</li>'.format(tmp_string1_1, tmp_string1_2)
elif subtask.state == 'todo' and record.env.user == subtask.reviewer_id:
tmp_string2_1 = escape('{0}'.format(subtask.user_id.name))
tmp_string2_2 = escape('{0}'.format(tmp_subtask_name))
result_string2 += '<li>TODO for <em>{0}</em>: {1}</li>'.format(tmp_string2_1, tmp_string2_2)
record.kanban_subtasks = '<ul>' + result_string1 + result_string3 + result_string2 + '</ul>'
result_string_td = ''
result_string_wt = ''
if record.subtask_ids:
task_todo_ids = record.subtask_ids.filtered(
lambda x: x.state == 'todo' and x.user_id.id == record.env.user.id)
task_waiting_ids = record.subtask_ids.filtered(
lambda x: x.state == 'waiting' and x.user_id.id == record.env.user.id)
if task_todo_ids:
tmp_string_td = escape(': {0}'.format(len(task_todo_ids)))
result_string_td += '<li><b>TODO{}</b></li>'.format(tmp_string_td)
if task_waiting_ids:
tmp_string_wt = escape(': {0}'.format(len(task_waiting_ids)))
result_string_wt += '<li><b>Waiting{}</b></li>'.format(tmp_string_wt)
record.kanban_subtasks = '<div class="kanban_subtasks"><ul>' + \
result_string_td + result_string_wt + '</ul></div>'

@api.multi
def _compute_completion(self):
for record in self:
record.completion = record.task_completion()

@api.multi
def _compute_completion_xml(self):
for record in self:
active_subtasks = record.subtask_ids and record.subtask_ids.filtered(
lambda x: x.user_id.id == record.env.user.id and x.state != 'cancelled')
if not active_subtasks:
record.completion_xml = """
<div class="task_progress">
</div>
"""
continue

completion = record.task_completion()
color = 'bg-success-full'
if completion < 50:
color = 'bg-danger-full'
record.completion_xml = """
<div class="task_progress">
<div class="progress_info">
Your Checklist:
</div>
<div class ="o_kanban_counter_progress progress task_progress_bar">
<div data-filter="done"
class ="progress-bar {1} o_bar_has_records task_progress_bar_done"
data-original-title="1 done"
style="width: {0}%;">
</div>
<div data-filter="blocked"
class ="progress-bar bg-danger-full"
data-original-title="0 blocked">
</div>
</div>
<div class="task_completion"> {0}% </div>
</div>
""".format(int(completion), color)

def task_completion(self):
user_task_ids = self.subtask_ids.filtered(lambda x: x.user_id.id == self.env.user.id and x.state != 'cancelled')
if not user_task_ids:
return 100
user_done_task_ids = user_task_ids.filtered(lambda x: x.state == 'done')
return (len(user_done_task_ids) / len(user_task_ids)) * 100

@api.multi
def send_subtask_email(self, subtask_name, subtask_state, subtask_reviewer_id, subtask_user_id, old_name=None):
@@ -177,3 +227,13 @@ def send_subtask_email(self, subtask_name, subtask_state, subtask_reviewer_id, s
subtype=subtype,
body=body,
partner_ids=partner_ids)

@api.multi
def copy(self, default=None):
task = super(Task, self).copy(default)
for subtask in self.subtask_ids:
subtask.copy({
'task_id': task.id,
'state': subtask.state,
})
return task
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

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

<!-- <record model="ir.rule" id="project_description_subtask_rule"> -->
<!-- <field name="name">Project: only reviewer can change description</field> -->
@@ -34,5 +34,4 @@
<!-- <field name="domain_force">[('uid','!=','reviewer_id')]</field> -->
<!-- </record> -->

</data>
</openerp>
</odoo>
@@ -0,0 +1,35 @@
.task_progress {
width:40%;
display:inline-block;
font-size: 10px;
}

.task_progress {
width:40%;
display:inline-block;
font-size: 10px;
}
.task_progress .task_progress_bar{
width:85%;
display:inline-block;
margin-bottom:0px;
height: 10px;
}
.task_progress .task_progress_bar_done{
max-width: 100%;
min-width: 3%;
}
.task_progress .task_completion{
width:10%;
display:inline-block;
height: 13px;
}

.kanban_subtasks {
width: 55%;
display:inline-block;
font-size: 10px;
}
.kanban_subtasks ul{
-webkit-padding-start: 30px;
}
Oops, something went wrong.

0 comments on commit 8921d1e

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.