diff options
| author | Divyesh Makwana (Open ERP) <mdi@tinyerp.com> | 2012-07-03 14:28:16 +0530 |
|---|---|---|
| committer | Divyesh Makwana (Open ERP) <mdi@tinyerp.com> | 2012-07-03 14:28:16 +0530 |
| commit | f28cfcfe8a16e77acd7e390e25fff2793e4e6548 (patch) | |
| tree | fe3fad1ad3f95ff11a34638ea5c7f325cecfa25c /addons/project | |
| parent | 9ce0d57fbe8357e00e72123e7e4c07326b26b261 (diff) | |
| parent | 1e123ce0c86060be9ad66fa8962912b14597c699 (diff) | |
[Merge] Merge with main addons.
bzr revid: mdi@tinyerp.com-20120703043709-c8o4k6hjfw5v8gn0
bzr revid: mdi@tinyerp.com-20120703085816-mc75d3ukecz03m79
Diffstat (limited to 'addons/project')
| -rw-r--r-- | addons/project/project.py | 39 | ||||
| -rw-r--r-- | addons/project/project_view.xml | 87 |
2 files changed, 106 insertions, 20 deletions
diff --git a/addons/project/project.py b/addons/project/project.py index 05a81c99514..487daa834bb 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -480,21 +480,14 @@ def Project(): # ------------------------------------------------ # OpenChatter methods and notifications # ------------------------------------------------ - - def get_needaction_user_ids(self, cr, uid, ids, context=None): - result = dict.fromkeys(ids) - for obj in self.browse(cr, uid, ids, context=context): - result[obj.id] = [] - if obj.state == 'draft' and obj.user_id: - result[obj.id] = [obj.user_id.id] - return result def message_get_subscribers(self, cr, uid, ids, context=None): - sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context); + """ Override to add responsible user. """ + user_ids = super(project, self).message_get_subscribers(cr, uid, ids, context=context) for obj in self.browse(cr, uid, ids, context=context): - if obj.user_id: - sub_ids.append(obj.user_id.id) - return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) + if obj.user_id and not obj.user_id.id in user_ids: + user_ids.append(obj.user_id.id) + return user_ids def create(self, cr, uid, vals, context=None): obj_id = super(project, self).create(cr, uid, vals, context=context) @@ -1145,20 +1138,26 @@ class task(base_stage, osv.osv): return 'Task' def get_needaction_user_ids(self, cr, uid, ids, context=None): - result = dict.fromkeys(ids, []) + """ Returns the user_ids that have to perform an action. + Add to the previous results given by super the document responsible + when in draft mode. + :return: dict { record_id: [user_ids], } + """ + result = super(task, self).get_needaction_user_ids(cr, uid, ids, context=context) for obj in self.browse(cr, uid, ids, context=context): if obj.state == 'draft' and obj.user_id: - result[obj.id] = [obj.user_id.id] + result[obj.id].append(obj.user_id.id) return result def message_get_subscribers(self, cr, uid, ids, context=None): - sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context); + """ Override to add responsible user and project manager. """ + user_ids = super(task, self).message_get_subscribers(cr, uid, ids, context=context) for obj in self.browse(cr, uid, ids, context=context): - if obj.user_id: - sub_ids.append(obj.user_id.id) - if obj.manager_id: - sub_ids.append(obj.manager_id.id) - return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) + if obj.user_id and not obj.user_id.id in user_ids: + user_ids.append(obj.user_id.id) + if obj.manager_id and not obj.manager_id.id in user_ids: + user_ids.append(obj.manager_id.id) + return user_ids def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index e58aad743dd..cf501740456 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -21,6 +21,43 @@ view_mode="kanban,tree,form,calendar,graph" view_type="form"/> + <!-- Project Read/Unread actions --> + <record id="actions_server_project_unread" model="ir.actions.server"> + <field name="name">Mark unread</field> + <field name="condition">True</field> + <field name="type">ir.actions.server</field> + <field name="model_id" ref="model_project_project"/> + <field name="state">code</field> + <field name="code">self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)</field> + </record> + <record id="action_project_unread" model="ir.values"> + <field name="name">action_project_unread</field> + <field name="action_id" ref="actions_server_project_unread"/> + <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_project_unread'))" /> + <field name="key">action</field> + <field name="model_id" ref="model_project_project" /> + <field name="model">project.project</field> + <field name="key2">client_action_multi</field> + </record> + + <record id="actions_server_project_read" model="ir.actions.server"> + <field name="name">Mark read</field> + <field name="condition">True</field> + <field name="type">ir.actions.server</field> + <field name="model_id" ref="model_project_project"/> + <field name="state">code</field> + <field name="code">self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)</field> + </record> + <record id="action_project_read" model="ir.values"> + <field name="name">action_project_read</field> + <field name="action_id" ref="actions_server_project_read"/> + <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_project_read'))" /> + <field name="key">action</field> + <field name="model_id" ref="model_project_project" /> + <field name="model">project.project</field> + <field name="key2">client_action_multi</field> + </record> + <!-- Project --> <record id="edit_project" model="ir.ui.view"> <field name="name">project.project.form</field> @@ -126,6 +163,11 @@ <group> <field name="complete_name" string="Project Name"/> <separator orientation="vertical"/> + <filter icon="terp-mail-message-new" + string="Inbox" help="Unread messages" + name="needaction_pending" + domain="[('needaction_pending','=',True)]"/> + <separator orientation="vertical"/> <filter icon="terp-check" string="Open" name="Current" domain="[('state', '=','open')]" help="Open Projects"/> <filter icon="gtk-media-pause" string="Pending" name="Pending" domain="[('state', '=','pending')]" help="Pending Projects"/> <filter icon="gtk-media-pause" string="Template" name="Template" domain="[('state', '=','template')]" help="Templates of Projects"/> @@ -308,6 +350,44 @@ </record> <!-- Task --> + + <!-- Task Read/Unread actions --> + <record id="actions_server_project_task_unread" model="ir.actions.server"> + <field name="name">Mark unread</field> + <field name="condition">True</field> + <field name="type">ir.actions.server</field> + <field name="model_id" ref="model_project_task"/> + <field name="state">code</field> + <field name="code">self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)</field> + </record> + <record id="action_project_task_unread" model="ir.values"> + <field name="name">action_project_task_unread</field> + <field name="action_id" ref="actions_server_project_task_unread"/> + <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_project_task_unread'))" /> + <field name="key">action</field> + <field name="model_id" ref="model_project_task" /> + <field name="model">project.task</field> + <field name="key2">client_action_multi</field> + </record> + + <record id="actions_server_project_task_read" model="ir.actions.server"> + <field name="name">Mark read</field> + <field name="condition">True</field> + <field name="type">ir.actions.server</field> + <field name="model_id" ref="model_project_task"/> + <field name="state">code</field> + <field name="code">self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)</field> + </record> + <record id="action_project_task_read" model="ir.values"> + <field name="name">action_project_task_read</field> + <field name="action_id" ref="actions_server_project_task_read"/> + <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_project_task_read'))" /> + <field name="key">action</field> + <field name="model_id" ref="model_project_task" /> + <field name="model">project.task</field> + <field name="key2">client_action_multi</field> + </record> + <record id="view_task_form2" model="ir.ui.view"> <field name="name">project.task.form</field> <field name="model">project.task</field> @@ -440,6 +520,8 @@ <field name="kanban_state"/> <field name="remaining_hours" sum="Remaining Time" groups="project.group_time_work_estimation_tasks"/> <field name="date_deadline"/> + <field name="message_summary"/> + <field name="needaction_pending"/> <templates> <t t-name="kanban-box"> <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click"> @@ -568,6 +650,11 @@ <group> <field name="name" string="Tasks"/> <separator orientation="vertical"/> + <filter icon="terp-mail-message-new" + string="Inbox" help="Unread messages" + name="needaction_pending" + domain="[('needaction_pending','=',True)]"/> + <separator orientation="vertical"/> <filter name="draft" string="New" domain="[('state','=','draft')]" help="New Tasks" icon="terp-check"/> <filter name="open" string="In Progress" domain="[('state','=','open')]" help="In Progress Tasks" icon="terp-camera_test"/> <filter string="Pending" domain="[('state','=','pending')]" context="{'show_delegated':False}" help="Pending Tasks" icon="terp-gtk-media-pause"/> |
