diff --git a/addons/account/product_view.xml b/addons/account/product_view.xml
index 98f9f93dfa7..8591b28b173 100644
--- a/addons/account/product_view.xml
+++ b/addons/account/product_view.xml
@@ -51,12 +51,12 @@
form
-
+
+
diff --git a/addons/account_anglo_saxon/product_view.xml b/addons/account_anglo_saxon/product_view.xml
index 8a79d96d1c4..b88f8f2db42 100644
--- a/addons/account_anglo_saxon/product_view.xml
+++ b/addons/account_anglo_saxon/product_view.xml
@@ -34,12 +34,11 @@
form
-
+
+
diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml
index cb2e5391018..76bb0c24cb5 100644
--- a/addons/base_calendar/base_calendar_view.xml
+++ b/addons/base_calendar/base_calendar_view.xml
@@ -45,10 +45,10 @@
-
+
-
+
diff --git a/addons/caldav/wizard/caldav_browse_view.xml b/addons/caldav/wizard/caldav_browse_view.xml
index 8f06ed47ddd..29f455d764f 100644
--- a/addons/caldav/wizard/caldav_browse_view.xml
+++ b/addons/caldav/wizard/caldav_browse_view.xml
@@ -7,13 +7,36 @@
caldav.browse
form
-
@@ -29,12 +52,11 @@
or
-
-
-
-
-
-
+
+
+
+
+
@@ -50,11 +72,14 @@
or
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 92dd6d6e837..69d390ff04d 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -273,14 +273,6 @@ class crm_lead(base_stage, osv.osv):
'color': 0,
}
- 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):
- # salesman must perform an action when in draft mode
- if obj.state == 'draft' and obj.user_id:
- result[obj.id] = [obj.user_id.id]
- return result
-
def create(self, cr, uid, vals, context=None):
obj_id = super(crm_lead, self).create(cr, uid, vals, context)
self.create_send_note(cr, uid, [obj_id], context=context)
@@ -770,64 +762,6 @@ class crm_lead(base_stage, osv.osv):
'type': 'ir.actions.act_window',
}
-
- def message_new(self, cr, uid, msg, custom_values=None, context=None):
- """Automatically calls when new email message arrives"""
- res_id = super(crm_lead, self).message_new(cr, uid, msg, custom_values=custom_values, context=context)
- subject = msg.get('subject') or _("No Subject")
- body = msg.get('body_text')
-
- msg_from = msg.get('from')
- priority = msg.get('priority')
- vals = {
- 'name': subject,
- 'email_from': msg_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.get('from', False)))
- self.write(cr, uid, [res_id], vals, context)
- return res_id
-
- def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None):
- if isinstance(ids, (str, int, long)):
- ids = [ids]
- if vals == None:
- vals = {}
- super(crm_lead, self).message_update(cr, uid, ids, msg, context=context)
-
- if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES):
- vals['priority'] = msg.get('priority')
- maps = {
- 'cost':'planned_cost',
- 'revenue': 'planned_revenue',
- 'probability':'probability'
- }
- vls = {}
- for line in msg['body_text'].split('\n'):
- line = line.strip()
- res = tools.misc.command_re.match(line)
- if res and maps.get(res.group(1).lower()):
- key = maps.get(res.group(1).lower())
- vls[key] = res.group(2).lower()
- vals.update(vls)
-
- # Unfortunately the API is based on lists
- # but we want to update the state based on the
- # previous state, so we have to loop:
- for case in self.browse(cr, uid, ids, context=context):
- values = dict(vals)
- if case.state in CRM_LEAD_PENDING_STATES:
- #re-open
- values.update(state=crm.AVAILABLE_STATES[1][0])
- if not case.date_open:
- values['date_open'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
- res = self.write(cr, uid, [case.id], values, context=context)
- return res
-
def action_makeMeeting(self, cr, uid, ids, context=None):
"""
This opens Meeting's calendar view to schedule meeting on current Opportunity
@@ -882,19 +816,66 @@ class crm_lead(base_stage, osv.osv):
if stage.on_change:
vals['probability'] = stage.probability
return super(crm_lead,self).write(cr, uid, ids, vals, context)
-
+
+ # ----------------------------------------
+ # Mail Gateway
+ # ----------------------------------------
+
+ def message_new(self, cr, uid, msg, custom_values=None, context=None):
+ """ 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': msg.get('subject') or _("No Subject"),
+ 'description': msg.get('body_text'),
+ 'email_from': msg.get('from'),
+ 'email_cc': msg.get('cc'),
+ 'user_id': False,
+ })
+ if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES):
+ custom_values['priority'] = msg.get('priority')
+ custom_values.update(self.message_partner_by_email(cr, uid, msg.get('from', False), context=context))
+ return super(crm_lead, 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 document according to the email.
+ """
+ if isinstance(ids, (str, int, long)):
+ ids = [ids]
+ if update_vals is None: update_vals = {}
+
+ if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES):
+ vals['priority'] = msg.get('priority')
+ maps = {
+ 'cost':'planned_cost',
+ 'revenue': 'planned_revenue',
+ 'probability':'probability',
+ }
+ 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()):
+ key = maps.get(res.group(1).lower())
+ vals[key] = res.group(2).lower()
+
+ return super(crm_lead, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
+
# ----------------------------------------
# OpenChatter methods and notifications
# ----------------------------------------
def message_get_subscribers(self, cr, uid, ids, context=None):
- sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context)
- # add salesman to the subscribers
+ """ Override to add the salesman. """
+ user_ids = super(crm_lead, 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. """
stage_name = self.pool.get('crm.case.stage').name_get(cr, uid, [stage_id], context=context)[0][1]
diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml
index 7f8cbdf77aa..cbb5e0d8bb9 100644
--- a/addons/crm/crm_lead_demo.xml
+++ b/addons/crm/crm_lead_demo.xml
@@ -1,7 +1,10 @@
-
-
+
+
+
@@ -21,7 +24,6 @@
-
@@ -76,7 +78,6 @@
-
@@ -96,7 +97,6 @@
-
@@ -209,10 +209,21 @@
+
+
-
+
+
+
@@ -398,7 +409,7 @@
-
+
@@ -469,7 +480,7 @@
-
+
Thymbra
Palermo, Capital Federal
@@ -522,5 +533,12 @@
+
+
+
+
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index a2f3c30c611..629d2f43446 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -2,6 +2,43 @@
+
+
+ Mark unread
+ True
+ ir.actions.server
+
+ code
+ self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)
+
+
+ action_crm_lead_unread
+
+
+ action
+
+ crm.lead
+ 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_crm_lead_read
+
+
+ action
+
+ crm.lead
+ client_action_multi
+
+
@@ -172,9 +209,9 @@
-
+
+
@@ -185,8 +222,7 @@
crm.lead
tree
-
-
+
@@ -202,6 +238,7 @@
+
@@ -235,6 +272,8 @@
+
+