Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] project_gtd: migration 8.0 > 10.0 #308

Merged
merged 1 commit into from Jun 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
71 changes: 71 additions & 0 deletions project_gtd/README.rst
@@ -0,0 +1,71 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

==============
Project gtd
==============

This module implements a simple personal to-do list based on tasks. It adds an
editable list of tasks simplified to the minimum required fields in the project
application.

The to-do list is based on the *Getting Things Done* methodology. This
world-wide used methodology is used for personal time management improvement.

*Getting Things Done* (commonly abbreviated as *GTD*) is an action management
method created by David Allen, and described in a book of the same name.

*GTD* rests on the principle that a person needs to move tasks out of the mind
by recording them externally. That way, the mind is freed from the job of
remembering everything that needs to be done, and can concentrate on actually
performing those tasks.

Usage
=====

To use this module, you need to:

#. Go to `Project / Configuration / GTD / Timeboxes` to configure your timeboxes.
#. Here, your new timebox is empty and not visible yet. You need to add tasks in it to make it visible.
#. Go to `Project / Tasks` and edit a task to set the 'Timebox' field.
#. Now go to `Project / Tasks (GTD)` to drag and drop your tasks between timeboxes.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/140/10.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/project/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.

Credits
=======

Contributors
------------

* OpenERP SA
* Sébastien ALIX <sebastien.alix@osiell.com>
* Matthieu MÉQUIGNON <matthieu.mequignon@osiell.com>

Do not contact contributors directly about support or help with technical issues.

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
16 changes: 0 additions & 16 deletions project_gtd/__init__.py
@@ -1,20 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# 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/>.
#
##############################################################################

from . import project_gtd
from . import wizard
Expand Down
50 changes: 6 additions & 44 deletions project_gtd/__manifest__.py
@@ -1,50 +1,15 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
# Copyright 2004-2010 Tiny SPRL <http://tiny.be>.
# Copyright 2017 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Todo Lists',
'version': '8.0.2.0.0',
'version': '10.0.1.0.0',
'category': 'Project Management',
'sequence': 100,
'summary': 'Personal Tasks, Contexts, Timeboxes',
'description': """
Implement the *Getting Things Done* methodology
===============================================

This module implements a simple personal to-do list based on tasks. It adds an
editable list of tasks simplified to the minimum required fields in the project
application.

The to-do list is based on the *Getting Things Done* methodology. This
world-wide used methodology is used for personal time management improvement.

*Getting Things Done* (commonly abbreviated as *GTD*) is an action management
method created by David Allen, and described in a book of the same name.

*GTD* rests on the principle that a person needs to move tasks out of the mind
by recording them externally. That way, the mind is freed from the job of
remembering everything that needs to be done, and can concentrate on actually
performing those tasks.
""",
'author': "OpenERP SA,Odoo Community Association (OCA)",
'author': "Odoo SA, Odoo Community Association (OCA), ABF OSIELL",
'license': 'AGPL-3',
'depends': ['project'],
'data': [
Expand All @@ -55,9 +20,6 @@
'wizard/project_gtd_fill_view.xml',
],
'demo': ['project_gtd_demo.xml'],
'test': ['test/task_timebox.yml'],
'installable': False,
'installable': True,
'auto_install': False,
}

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
183 changes: 56 additions & 127 deletions project_gtd/project_gtd.py
@@ -1,156 +1,87 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################

from openerp.osv import fields, osv
from openerp import tools


class project_gtd_context(osv.Model):
# Copyright 2004-2010 Tiny SPRL <http://tiny.be>.
# Copyright 2017 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models, tools


class ProjectGtdContext(models.Model):
_name = "project.gtd.context"
_description = "Context"
_columns = {
'name': fields.char(
'Context', size=64, required=True, translate=True),
'sequence': fields.integer(
'Sequence',
help=("Gives the sequence order when displaying "
"a list of contexts.")),
}
_defaults = {
'sequence': 1
}
_order = "sequence, name"

name = fields.Char(
'Context', required=True, translate=True)
sequence = fields.Integer(
'Sequence',
help="Gives the sequence order when displaying a list of contexts.",
default=1)


class project_gtd_timebox(osv.Model):
class ProjectGtdTimebox(models.Model):
_name = "project.gtd.timebox"
_order = "sequence"
_columns = {
'name': fields.char(
'Timebox', size=64, required=True, select=1, translate=1),
'sequence': fields.integer(
'Sequence',
help="Gives the sequence order when displaying "
"a list of timebox."),
}

name = fields.Char(
'Timebox', size=64, required=True, index=1, translate=1)
sequence = fields.Integer(
'Sequence',
help="Gives the sequence order when displaying "
"a list of timebox.")


class project_task(osv.Model):
class ProjectTask(models.Model):
_inherit = "project.task"
_columns = {
'timebox_id': fields.many2one(
'project.gtd.timebox',
"Timebox",
help="Time-laps during which task has to be treated"),
'context_id': fields.many2one(
'project.gtd.context',
"Context",
help="The context place where user has to treat task"),
}

def _get_context(self, cr, uid, context=None):
ids = self.pool.get('project.gtd.context').search(
cr, uid, [], context=context)
return ids and ids[0] or False
@api.model
def _get_context(self):
contexts = self.env['project.gtd.context'].search([])
return contexts and contexts[0] or False

timebox_id = fields.Many2one(
'project.gtd.timebox',
"Timebox",
help="Time-laps during which task has to be treated")
context_id = fields.Many2one(
'project.gtd.context',
"Context",
help="The context place where user has to treat task",
default=_get_context)

def _read_group_timebox_ids(
self, cr, uid, ids, domain,
read_group_order=None, access_rights_uid=None, context=None):
self, domain, read_group_order=None, access_rights_uid=None):
"""Used to display all timeboxes on the view."""
timebox_obj = self.pool.get('project.gtd.timebox')
order = timebox_obj._order
access_rights_uid = access_rights_uid or uid
timebox_ids = timebox_obj._search(
cr, uid, [],
order=order, access_rights_uid=access_rights_uid, context=context)
result = timebox_obj.name_get(
cr, access_rights_uid, timebox_ids, context=context)
timebox_model = self.env['project.gtd.timebox']
timeboxes = timebox_model.search([])
timebox_ids = timeboxes.ids
result = timeboxes.name_get()
# Restore order of the search
result.sort(
lambda x, y: cmp(timebox_ids.index(x[0]), timebox_ids.index(y[0])))
fold = dict.fromkeys(timebox_ids, False)
fold = dict.fromkeys(timeboxes, False)
return result, fold

_defaults = {
'context_id': _get_context
}

_group_by_full = {
'timebox_id': _read_group_timebox_ids,
}

def copy_data(self, cr, uid, id, default=None, context=None):
if context is None:
context = {}
@api.model
def copy_data(self, default=None):
if not default:
default = {}
if not default.get('timebox_id'):
if not default.get('timebox_id'):
default['timebox_id'] = False
if not default.get('context_id'):
if not default.get('context_id'):
default['context_id'] = False
return super(project_task, self).copy_data(
cr, uid, id, default, context)

def next_timebox(self, cr, uid, ids, *args):
timebox_obj = self.pool.get('project.gtd.timebox')
timebox_ids = timebox_obj.search(cr, uid, [])
if not timebox_ids:
return True
for task in self.browse(cr, uid, ids):
timebox = task.timebox_id
if not timebox:
self.write(cr, uid, task.id, {'timebox_id': timebox_ids[0]})
elif timebox_ids.index(timebox) != len(timebox_ids)-1:
index = timebox_ids.index(timebox)
self.write(
cr, uid, task.id, {'timebox_id': timebox_ids[index+1]})
return True

def prev_timebox(self, cr, uid, ids, *args):
timebox_obj = self.pool.get('project.gtd.timebox')
timebox_ids = timebox_obj.search(cr, uid, [])
for task in self.browse(cr, uid, ids):
timebox = task.timebox_id
if timebox:
if timebox_ids.index(timebox):
index = timebox_ids.index(timebox)
self.write(
cr, uid, task.id,
{'timebox_id': timebox_ids[index - 1]})
else:
self.write(cr, uid, task.id, {'timebox_id': False})
return True

def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
if not context:
context = {}
res = super(project_task, self).fields_view_get(
cr, uid, view_id, view_type, context,
toolbar=toolbar, submenu=submenu)
search_extended = False
timebox_obj = self.pool.get('project.gtd.timebox')
if (res['type'] == 'search') and context.get('gtd', False):
timeboxes = timebox_obj.browse(
cr, uid, timebox_obj.search(cr, uid, []), context=context)
return super(ProjectTask, self).copy_data(default)

@api.model
def fields_view_get(self, *args, **kwargs):
res = super(ProjectTask, self).fields_view_get(*args, **kwargs)
timebox_model = self.env['project.gtd.timebox']
if (res['type'] == 'search') and self.env.context.get('gtd', False):
timeboxes = timebox_model.search([])
search_extended = ''
for timebox in timeboxes:
filter_ = u"""
Expand All @@ -163,5 +94,3 @@ def fields_view_get(self, cr, uid, view_id=None, view_type='form',
'<separator name="gtdsep"/>', search_extended)

return res

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
6 changes: 3 additions & 3 deletions project_gtd/project_gtd_data.xml
Expand Up @@ -26,9 +26,9 @@

<!-- notify all employees of module installation -->
<record model="mail.message" id="module_install_notification">
<field name="model">mail.group</field>
<field name="res_id" ref="mail.group_all_employees"/>
<field name="type">notification</field>
<field name="model">mail.channel</field>
<field name="res_id" ref="mail.channel_all_employees"/>
<field name="message_type">notification</field>
<field name="subtype_id" ref="mail.mt_comment"/>
<field name="subject">Todo Lists application installed!</field>
<field name="body"><![CDATA[<p>Add todo items on project tasks, to help you organize your work.</p><p>
Expand Down