From: user Date: Mon, 18 Mar 2013 17:13:48 +0000 (+0100) Subject: Validation initiale X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=567272aa3112ddfd40e10ca7b0581396e4214b1b;p=OpenERP%2Ftodolist.git Validation initiale --- 567272aa3112ddfd40e10ca7b0581396e4214b1b diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..ca5f72b --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +import todolist \ No newline at end of file diff --git a/__openerp__.py b/__openerp__.py new file mode 100644 index 0000000..430af22 --- /dev/null +++ b/__openerp__.py @@ -0,0 +1,22 @@ +{ + "name": "TodoList", + "version": "1.0", + "depends": ["base"], + "author": "Moi", + "category": "Category", + "description": """Liste des choses à faire.""", + "data": [ + 'security/todolist_security.xml', + 'security/ir.model.access.csv', + 'views/todolist.xml', + # fichiers de données (vues, ...) + ], + "demo": [ + # fichiers de données de démonstration + ], + "test": [ + # fichiers de test + ], + "installable": True, + "auto_install": False, +} \ No newline at end of file diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv new file mode 100644 index 0000000..d1990c5 --- /dev/null +++ b/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_theme_user,todolist.theme,model_todolist_theme,group_todolist_user,1,0,0,0 +access_theme_manager,todolist.theme.manager,model_todolist_theme,group_todolist_manager,1,1,1,1 +access_todolist_user,todolist.todolist,model_todolist_todolist,group_todolist_user,1,1,1,1 +access_action_user,todolist.action,model_todolist_action,group_todolist_user,1,1,1,1 diff --git a/security/todolist_security.xml b/security/todolist_security.xml new file mode 100644 index 0000000..80aa2f2 --- /dev/null +++ b/security/todolist_security.xml @@ -0,0 +1,21 @@ + + + + + Todolist Category + + + + User + + The user will be able to use ToDoList. + + + + Manager + The user will be able to edit theme. + + + + + \ No newline at end of file diff --git a/todolist.py b/todolist.py new file mode 100644 index 0000000..a2e82e4 --- /dev/null +++ b/todolist.py @@ -0,0 +1,123 @@ +#-*- coding: utf8 -*- + +from openerp.osv import osv, fields +from reportlab.lib.xmllib import _Name + +class TodoList(osv.Model): + _name = "todolist.todolist" + + _status = [('draft', 'Brouillon'), ('pending', 'En cours'), ('done', 'Termine')] + + _columns = { + "name": fields.char(string='Title', size=64, required=True), + "description": fields.text(string="Description"), + "date_cible": fields.date(string='Cible'), + "date_jalon": fields.date(string='Jalon'), + "manday": fields.integer(string="Jours/homme"), + "valide": fields.boolean(string='Validé'), + "assigned": fields.many2one("res.partner", string="Assigné à", domain=[("is_company", "=", False)]), + "state": fields.selection(_status, string="State", select=True), + "actions": fields.one2many('todolist.action', 'todolist_id', string="Action"), + "themes_id": fields.many2many('todolist.theme', 'todolist_todolist_theme_rel', 'todolist_id', 'theme_id', string='Thèmes', domain=[("actif", "=", True)]), + + } + + _defaults = { + "state": "draft", + } + + _sql_constraints = [ + ( + 'nom_de_la_contrainte', + 'CHECK(name <> description)', + 'Le nom doit être différent de la description', + ), + ( + 'cible_and_jalon_constraint', + 'CHECK(date_cible < date_jalon)', + 'La cible doit être inferieur au jalon', + ), + ] + + def vider_description(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'description': ''}, context=context) + return self + + def action_start(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'pending'}, context=context) + return self + + + def action_stop(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'done'}, context=context) + return self + + + def action_restart(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'draft'}, context=context) + return self + + + +# ------------------- class Action ------------------- # + +class Action(osv.Model): + _name = "todolist.action" + + _priorities = [('utile', 'Utile'), ('necessary', 'Nécéssaire'), ('indispensable', 'Indispensable')] + + _states = [('draft', 'Brouillon'), ('proposal', 'Proposition'), ('valid', 'Validé'), ('begin', 'Débute'), ('done', 'Terminé')] + + _columns = { + "name": fields.char(string='Title', size=64, required=True), + "description": fields.text(string='Description'), + "deadline": fields.date(string='Jalon'), + "planned": fields.date(string='Planifié'), + "manday": fields.integer(string='Jours/homme'), + "priority": fields.selection(_priorities, string='Priorite', select=True), + "state": fields.selection(_states, string='State', select=True), + "todolist_id": fields.many2one('todolist.todolist', string="TodoList", required=True), + } + + _defaults = { + "state": "draft" + } + + def action_draft(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'draft'}, context=context) + return self + + def action_propose(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'proposal'}, context=context) + return self + + def action_validate(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'valid'}, context=context) + return self + + def action_begin(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'begin'}, context=context) + return self + + def action_done(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'done'}, context=context) + return self + + +# ------------------- class Theme ------------------- # + +class Theme(osv.Model): + _name = "todolist.theme" + + _states = [('Actif', 'Actif'), ('Inactif', 'Inactif')] + + _columns = { + "name": fields.char(string='Title', size=64, required=True), + "description": fields.text(string='Description'), + "actif": fields.selection(_states, string='Actif', select=True), + "todolist_ids": fields.many2many('todolist.todolist', 'todolist_todolist_theme_rel', 'theme_id', 'todolist_id', string='TODO Listes'), + } + + _defaults = { + 'actif': 'actif' + } \ No newline at end of file diff --git a/views/todolist.xml b/views/todolist.xml new file mode 100644 index 0000000..caf8fa3 --- /dev/null +++ b/views/todolist.xml @@ -0,0 +1,192 @@ + + + + + + + todolist.form + todolist.todolist + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + theme.form + todolist.theme + +
+ + + + + + +
+
+
+ + + + theme.kanban + todolist.theme + + + + +
+
+ +
+ X + +
+
+
+
+

+ +
+
+ + + + + + + + + todolist.form + todolist.action + +
+
+
+ + + + + + + + + + + +
+
+
+ + + + Todolists + todolist.todolist + tree,form + +

Créer votre première todolist

+
+
+ + + + Liste des thèmes + todolist.theme + kanban,tree,form + +

Créer votre premier thème

+
+
+ + + + Liste des actions + todolist.action + tree,form + +

Créer votre première action

+
+
+ + + + + + + + + + + + + + \ No newline at end of file