@@ -568,6 +650,11 @@
+
+
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 009f2b8ecf7..fea7a64d2b7 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -467,87 +467,68 @@ class project_issue(base_stage, osv.osv):
# -------------------------------------------------------
def message_new(self, cr, uid, msg, custom_values=None, context=None):
- """Automatically called when new email message arrives"""
- if context is None:
- context = {}
- subject = msg.get('subject') or _('No Title')
- body = msg.get('body_text')
- msg_from = msg.get('from')
- priority = msg.get('priority')
- vals = {
- 'name': subject,
- 'email_from': msg_from,
+ """ Overrides mail_thread message_new that is called by the mailgateway
+ through message_process.
+ This override updates the document according to the email.
+ """
+ if custom_values is None: custom_values = {}
+ if context is None: context = {}
+ context['state_to'] = 'draft'
+
+ custom_values.update({
+ 'name': msg.get('subject') or _("No Subject"),
+ 'description': msg.get('body_text'),
+ 'email_from': msg.get('from'),
'email_cc': msg.get('cc'),
- 'description': body,
'user_id': False,
- }
- if priority:
- vals['priority'] = priority
- vals.update(self.message_partner_by_email(cr, uid, msg_from))
- context.update({'state_to' : 'draft'})
+ })
+ if msg.get('priority'):
+ custom_values['priority'] = msg.get('priority')
+ custom_values.update(self.message_partner_by_email(cr, uid, msg.get('from'), context=context))
- if custom_values and isinstance(custom_values, dict):
- vals.update(custom_values)
-
- res_id = self.create(cr, uid, vals, context)
- self.message_append_dict(cr, uid, [res_id], msg, context=context)
+ res_id = super(project_issue, self).message_new(cr, uid, msg, custom_values=custom_values, context=context)
self.convert_to_bug(cr, uid, [res_id], context=context)
return res_id
- def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None):
- if vals is None:
- vals = {}
-
+ def message_update(self, cr, uid, ids, msg, update_vals=None, context=None):
+ """ Overrides mail_thread message_update that is called by the mailgateway
+ through message_process.
+ This method updates the document according to the email.
+ """
if isinstance(ids, (str, int, long)):
ids = [ids]
+ if update_vals is None: update_vals = {}
- vals.update({
- 'description': msg['body_text']
- })
- if msg.get('priority', False):
- vals['priority'] = msg.get('priority')
-
+ # Update doc values according to the message
+ update_vals['description'] = msg.get('body_text', '')
+ if msg.get('priority'):
+ update_vals['priority'] = msg.get('priority')
+ # Parse 'body_text' to find values to update
maps = {
'cost': 'planned_cost',
'revenue': 'planned_revenue',
- 'probability': 'probability'
+ 'probability': 'probability',
}
-
- # Reassign the 'open' state to the case if this one is in pending or done
- for record in self.browse(cr, uid, ids, context=context):
- if record.state in ('pending', 'done'):
- self.case_set(cr, uid, ids, 'open', {}, context=context)
-
- vls = { }
- for line in msg['body_text'].split('\n'):
+ for line in msg.get('body_text', '').split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
if res and maps.get(res.group(1).lower(), False):
key = maps.get(res.group(1).lower())
- vls[key] = res.group(2).lower()
+ update_vals[key] = res.group(2).lower()
- vals.update(vls)
- res = self.write(cr, uid, ids, vals)
- self.message_append_dict(cr, uid, ids, msg, context=context)
- return res
+ return super(project_issue, self).message_update(cr, uid, ids, update_vals=update_vals, context=context)
# -------------------------------------------------------
# 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):
- 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_issue, 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 stage_set_send_note(self, cr, uid, ids, stage_id, context=None):
""" Override of the (void) default notification method. """
diff --git a/addons/project_issue/project_issue_demo.xml b/addons/project_issue/project_issue_demo.xml
index a213cb02c2e..b3fb4582cf2 100644
--- a/addons/project_issue/project_issue_demo.xml
+++ b/addons/project_issue/project_issue_demo.xml
@@ -227,5 +227,10 @@
+
+
+
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 87a5a4f1f40..cdcea2cbb62 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -4,6 +4,43 @@
+
+
+ Mark unread
+ True
+ ir.actions.server
+
+ code
+ self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)
+
+
+ action_project_issue_unread
+
+
+ action
+
+ project.issue
+ client_action_multi
+
+
+
+ Mark read
+ True
+ ir.actions.server
+
+ code
+ self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)
+
+
+ action_project_issue_read
+
+
+ action
+
+ project.issue
+ client_action_multi
+
+
Issue Version
project.issue.version
@@ -159,9 +196,13 @@
+
+
-
diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py
index a36366f450e..0ca2687b7f0 100644
--- a/addons/project_mailgate/project_mailgate.py
+++ b/addons/project_mailgate/project_mailgate.py
@@ -19,30 +19,35 @@
#
##############################################################################
+import binascii
from osv import fields, osv
from tools.translate import _
import tools
-import binascii
-
class project_tasks(osv.osv):
_inherit = 'project.task'
def message_new(self, cr, uid, msg, custom_values=None, context=None):
- res_id = super(project_tasks,self).message_new(cr, uid, msg, custom_values=custom_values, context=context)
- subject = msg.get('subject')
- msg_from = msg.get('from')
- data = {
+ """ Overrides mail_thread message_new that is called by the mailgateway
+ through message_process.
+ This override updates the document according to the email.
+ """
+ if custom_values is None: custom_values = {}
+ custom_values.update({
'name': subject,
'planned_hours': 0.0,
- }
- data.update(self.message_partner_by_email(cr, uid, msg_from))
- self.write(cr, uid, [res_id], data, context)
- return res_id
-
- def message_update(self, cr, uid, ids, msg, data={}, default_act='pending'):
- act = 'do_'+default_act
+ 'subject': msg.get('subject'),
+ })
+ custom_values.update(self.message_partner_by_email(cr, uid, msg.get('from', False), context=context))
+ return super(project_tasks,self).message_new(cr, uid, msg, custom_values=custom_values, context=context)
+ def message_update(self, cr, uid, ids, msg, update_vals=None, context=None):
+ """ Overrides mail_thread message_update that is called by the mailgateway
+ through message_process.
+ This method updates the task according to the email.
+ """
+ if update_vals is None: update_vals = {}
+ act = False
maps = {
'cost':'planned_hours',
}
@@ -54,17 +59,15 @@ class project_tasks(osv.osv):
field = maps.get(match)
if field:
try:
- data[field] = float(res.group(2).lower())
+ update_vals[field] = float(res.group(2).lower())
except (ValueError, TypeError):
pass
elif match.lower() == 'state' \
and res.group(2).lower() in ['cancel','close','draft','open','pending']:
act = 'do_%s' % res.group(2).lower()
-
- self.write(cr, uid, ids, data, context=context)
- getattr(self,act)(cr, uid, ids, context=context)
- self.message_append_note(cr, uid, [res_id], body=msg, context=context)
- return True
+ if act:
+ getattr(self,act)(cr, uid, ids, context=context)
+ return super(project_tasks,self).message_update(cr, uid, msg, update_vals=update_vals, context=context)
def message_thread_followers(self, cr, uid, ids, context=None):
followers = super(project_tasks,self).message_thread_followers(cr, uid, ids, context=context)
@@ -74,5 +77,5 @@ class project_tasks(osv.osv):
followers[task.id] = filter(None, task_followers)
return followers
-project_tasks()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 775aebfaa8f..e74ca83a92b 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -733,10 +733,10 @@ class purchase_order(osv.osv):
# --------------------------------------
def get_needaction_user_ids(self, cr, uid, ids, context=None):
- result = dict.fromkeys(ids, [])
+ result = super(purchase_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
for obj in self.browse(cr, uid, ids, context=context):
if obj.state == 'approved':
- result[obj.id] = [obj.validator.id]
+ result[obj.id].append(obj.validator.id)
return result
def create_send_note(self, cr, uid, ids, context=None):
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index b56343d625c..d5a9b93f9ea 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -52,10 +52,10 @@
action="base.action_partner_category_form" id="menu_partner_categories_in_form" name="Partner Categories"
parent="purchase.menu_purchase_partner_cat" groups="base.group_no_one"/>
-
+
+ parent="menu_procurement_management"
+ action="base.action_partner_supplier_form" sequence="15"/>
-
-
+
+
Based on Draft Invoices
@@ -101,6 +101,43 @@
+
+
+ Mark unread
+ True
+ ir.actions.server
+
+ code
+ self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)
+
+
+ action_purchase_order_unread
+
+
+ action
+
+ purchase.order
+ client_action_multi
+
+
+
+ Mark read
+ True
+ ir.actions.server
+
+ code
+ self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)
+
+
+ action_purchase_order_read
+
+
+ action
+
+ purchase.order
+ client_action_multi
+
+
purchase.order.calendar
purchase.order
@@ -267,6 +304,11 @@
+
+
diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py
index ec7bc005d04..1b0c36b114b 100644
--- a/addons/purchase_requisition/purchase_requisition.py
+++ b/addons/purchase_requisition/purchase_requisition.py
@@ -183,13 +183,6 @@ class purchase_requisition(osv.osv):
return res
- 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):
- if (obj.state == 'draft') and obj.user_id:
- result[obj.id] = [obj.user_id.id]
- return result
-
def create_send_note(self, cr, uid, ids, context=None):
return self.message_append_note(cr, uid, ids, body=_("Purchase Requisition has been created."), context=context)
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 353228df599..0a3ebbe72ac 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -1022,10 +1022,10 @@ class sale_order(osv.osv):
# ------------------------------------------------
def get_needaction_user_ids(self, cr, uid, ids, context=None):
- result = dict.fromkeys(ids, [])
+ result = super(sale_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
for obj in self.browse(cr, uid, ids, context=context):
if (obj.state == 'manual' or obj.state == 'progress'):
- result[obj.id] = [obj.user_id.id]
+ result[obj.id].append(obj.user_id.id)
return result
def create_send_note(self, cr, uid, ids, context=None):
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 239cffe481f..ff5c28f7eb1 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -53,6 +53,43 @@
+
+
+ Mark unread
+ True
+ ir.actions.server
+
+ code
+ self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)
+
+
+ action_sale_order_unread
+
+
+ action
+
+ sale.order
+ client_action_multi
+
+
+
+ Mark read
+ True
+ ir.actions.server
+
+ code
+ self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)
+
+
+ action_sale_order_read
+
+
+ action
+
+ sale.order
+ client_action_multi
+
+
sale.order.calendar
sale.order
@@ -297,6 +334,11 @@
+
+