from openerp.osv import osv, fields
-
-
+# ------------- CONTAINER ------------- #
class Container(osv.Model):
"""TODO List : Tasks container"""
"manday": fields.function(_get_manday, type="integer", string="Man-Days"),
"state": fields.selection(_status, string="State", select=True),
"tasks": fields.one2many("todolist.task", "container_id", string="Tasks"),
- "topics_id": fields.many2many("todolist.topic", "todolist_container_topic_rel", "container_id", "topic_id", string="Topics", domain=[("activated", "=","Active")]),
+ "topic_ids": fields.many2many("semantics.topic",
+ "todolist_container_topic_rel",
+ "todolist_ids",
+ "topic_ids",
+ string="Topics",
+ domain=[("activated", "=","Active")]),
"number_tasks": fields.function(_get_nb_tasks, type="integer", string="Number of tasks"),
"number_tasks_done": fields.function(_get_nb_tasks_done, type="integer", string="Number of tasks done"),
"progress_tasks": fields.function(_tasks_progress, type="float", string="Progression"),
),
(
"target_before_milestone_constraint",
- "CHECK(target < milestone)",
+ "CHECK(target <= milestone)",
"The target date should be previous milestone date",
),
]
return osv.Model.search(self, cr, user, args, offset, limit, order, context, count)
+# ------------- TASK ------------- #
class Task(osv.Model):
"""TODO List : A task (something to do in a to do list)"""
),
(
"planned_before_milestone_constraint",
- "CHECK(planned < milestone)",
+ "CHECK(planned <= milestone)",
"The planned date should be previous milestone date",
),
(
vals["milestone"] = milestone
return osv.Model.create(self, cr, user, vals, context=context)
-
+# ------------- TOPIC ------------- #
class Topic(osv.Model):
"""TODO List : Container"s Topic"""
return result
- _name = "todolist.topic"
+ _name = "semantics.topic"
+
+ _inherit = "semantics.topic"
_states = [("Active", "Active"), ("Inactive", "Inactive")]
_columns = {
- "name": fields.char(string="Title", size=64, required=True),
- "description": fields.text(string="Description"),
"activated": fields.selection(_states, string="State", select=True),
- "todolist_ids": fields.many2many("todolist.container", "todolist_container_topic_rel", "topic_id", "Container_id", string="TO DO Lists"),
+ "todolist_ids": fields.many2many("todolist.container",
+ "todolist_container_topic_rel",
+ "topic_ids",
+ "todolist_ids",
+ string="TO DO Lists"),
"nb_lists": fields.function(_get_nb_lists, type="integer", string="Number of lists"),
"number_tasks": fields.function(_get_number_tasks, type="integer", string="Number of tasks"),
"number_tasks_done": fields.function(_get_number_tasks_done, type="integer", string="Number of tasks done"),
_defaults = {
"activated": "Active",
}
-
-
- _sql_constraints = [
- (
- "name_different_from_description_constraint",
- "CHECK(name <> description)",
- "Fields name and description should be different",
- ),
- ]