--- /dev/null
+import todolist
\ No newline at end of file
--- /dev/null
+{
+ "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
--- /dev/null
+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
--- /dev/null
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="category_todolist_groups" model="ir.module.category">
+ <field name="name">Todolist Category</field>
+ </record>
+
+ <record id="group_todolist_user" model="res.groups">
+ <field name="name">User</field>
+ <field name="category_id" ref="category_todolist_groups"/>
+ <field name="comment">The user will be able to use ToDoList.</field>
+ </record>
+
+ <record id="group_todolist_manager" model="res.groups">
+ <field name="name">Manager</field>
+ <field name="comment">The user will be able to edit theme.</field>
+ <field name="category_id" ref="category_todolist_groups"/>
+ <field name="implied_ids" eval="[(4, ref('todolist.group_todolist_user'))]"/>
+ </record>
+ </data>
+</openerp>
\ No newline at end of file
--- /dev/null
+#-*- 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
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+ <data>
+
+
+ <record model="ir.ui.view" id="todolist_form_view">
+ <field name="name">todolist.form</field>
+ <field name="model">todolist.todolist</field>
+ <field name="arch" type="xml">
+ <form string="Todolist Form" version="7.0">
+ <header>
+ <button string="Supprimer Description" type="object" name="vider_description" class="oe_highlight" />
+ <button string="Commencer" type="object" name="action_start" states="draft" class="oe_highlight" />
+ <button string="Terminer" type="object" name="action_stop" states="pending" class="oe_highlight" />
+ <button string="Recommencer" type="object" name="action_restart" states="pending,done" class="oe_highlight" />
+ <field name="state" widget="statusbar" />
+ </header>
+ <sheet>
+ <group colspan="4" col="3">
+ <label for="name" colspan="1" />
+ <field name="name" colspan="2" nolabel="1" />
+ <label for="description" colspan="1" />
+ <field name="description" colspan="2" nolabel="1" />
+ <label for="assigned" colspan="1" />
+ <field name="assigned" colspan="2" nolabel="1" />
+ </group>
+ <notebook colspan="4">
+ <page string="Dates">
+ <group colspan="4" col="1">
+ <label for="date_cible" />
+ <field name="date_cible" nolabel="1" />
+ <label for="date_jalon" />
+ <field name="date_jalon" nolabel="1" />
+ </group>
+ </page>
+ <page string="Paramétrages">
+ <group colspan="4" col="1">
+ <field name="manday" />
+ <field name="valide" />
+ </group>
+ </page>
+ <page string="Actions">
+ <group colspan="4" col="1">
+ <field name="actions" nolabel="1" mode="tree">
+ <tree string="Actions" editable="1" colors="red:priority=='indispensable';
+ #FF5800:priority=='necessary';
+ black:priority=='utile'">
+ <field name="name"/>
+ <field name="description"/>
+ <field name="deadline"/>
+ <field name="planned"/>
+ <field name="manday"/>
+ <field name="priority"/>
+ </tree>
+ </field>
+ </group>
+ </page>
+ <page string="Thèmes">
+ <group colspan="4" col="1">
+ <field name="themes_id"/>
+ </group>
+ </page>
+ </notebook>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+
+ <record model="ir.ui.view" id="theme_form_view">
+ <field name="name">theme.form</field>
+ <field name="model">todolist.theme</field>
+ <field name="arch" type="xml">
+ <form string="Theme Form" version="7.0">
+ <sheet>
+ <group colspan="4" col="4">
+ <label for="name" colspan="3"/>
+ <label for="actif" colspan="1"/>
+ <field name="name" nolabel="1" colspan="3"/>
+ <field name="actif" nolabel="1" colspan="1"/>
+ </group>
+ <group col="1">
+ <label for="description"/>
+ <field name="description" nolabel="1"/>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+
+ <record model="ir.ui.view" id="theme_kanban_view">
+ <field name="name">theme.kanban</field>
+ <field name="model">todolist.theme</field>
+ <field name="arch" type="xml">
+ <kanban default_group_by="actif">
+ <templates>
+ <t t-name="kanban-box">
+ <div class="oe_kanban_card oe_semantic_html_override oe_kanban_global_click_edit">
+ <div class="oe_dropdown_kanban">
+
+ <div class="oe_dropdown_toggle">
+ <span class="oe_e">X</span>
+ <ul class="oe_dropdown_menu">
+ <li><a type="delete">Delete</a></li>
+ </ul>
+ </div>
+ <div class="oe_clear" />
+ </div>
+ <div t-attf-class="oe_kanban_content">
+ <h1><field name="name" /></h1>
+ <field name="description" />
+ </div>
+ </div>
+ </t>
+ </templates>
+ </kanban>
+ </field>
+ </record>
+
+
+ <record model="ir.ui.view" id="action_form_view">
+ <field name="name">todolist.form</field>
+ <field name="model">todolist.action</field>
+ <field name="arch" type="xml">
+ <form string="Todolist Form" version="7.0">
+ <header>
+ <button string="Brouillon" type="object" name="action_draft" states="proposal,valid,begin" class="oe_highlight" />
+ <button string="Proposition" type="object" name="action_propose" states="draft, valid, begin" class="oe_highlight" />
+ <button string="Validé" type="object" name="action_validate" states="draft,proposal" class="oe_highlight" />
+ <button string="Débute" type="object" name="action_begin" states="draft,valid" class="oe_highlight" />
+ <button string="Terminé" type="object" name="action_done" states="begin" class="oe_highlight" />
+ <field name="state" widget="statusbar" />
+ </header>
+ <sheet>
+ <group>
+ <field name="name"/>
+ <field name="description" />
+ <field name="deadline" />
+ <field name="planned" />
+ <field name="manday" />
+ <field name="priority" />
+ <field name="todolist_id" />
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+
+ <record model="ir.actions.act_window" id="todolist_list_action">
+ <field name="name">Todolists</field>
+ <field name="res_model">todolist.todolist</field>
+ <field name="view_mode">tree,form</field>
+ <field name="help" type="html">
+ <p class="oe_view_nocontent_create">Créer votre première todolist</p>
+ </field>
+ </record>
+
+
+ <record model="ir.actions.act_window" id="theme_list_action">
+ <field name="name">Liste des thèmes</field>
+ <field name="res_model">todolist.theme</field>
+ <field name="view_mode">kanban,tree,form</field>
+ <field name="help" type="html">
+ <p class="oe_view_nocontent_create">Créer votre premier thème</p>
+ </field>
+ </record>
+
+
+ <record model="ir.actions.act_window" id="action_list_action">
+ <field name="name">Liste des actions</field>
+ <field name="res_model">todolist.action</field>
+ <field name="view_mode">tree,form</field>
+ <field name="help" type="html">
+ <p class="oe_view_nocontent_create">Créer votre première action</p>
+ </field>
+ </record>
+
+
+ <menuitem id="main_todolist_menu" name="TODO List" />
+
+ <menuitem id="todolist_menu" name="TO DO List" parent="main_todolist_menu" groups="group_todolist_user" />
+
+ <menuitem id="todo_menu" name="TODO" parent="todolist_menu" action="todolist_list_action"/>
+
+ <menuitem id="todo_theme_menu" name="Themes" parent="todolist_menu" action="theme_list_action" />
+
+ <menuitem id="todo_action_menu" name="Actions" parent="todolist_menu" action="action_list_action" />
+
+ </data>
+</openerp>
\ No newline at end of file