diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py
index 53f24dc69b0..b41621b6f00 100644
--- a/addons/crm/crm_opportunity.py
+++ b/addons/crm/crm_opportunity.py
@@ -60,7 +60,13 @@ class crm_opportunity(osv.osv):
@param *args: Tuple Value for additional Params
"""
res = super(crm_opportunity, self).case_close(cr, uid, ids, args)
- value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
+ data_obj = self.pool.get('ir.model.data')
+ data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead5')
+ stage_id = data_obj.browse(cr, uid, data_id).res_id
+ stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id)
+ value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id}
+ if stage_obj.on_change:
+ value.update({'probability': stage_obj.probability})
self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
@@ -79,9 +85,15 @@ class crm_opportunity(osv.osv):
@param *args: Tuple Value for additional Params
"""
res = super(crm_opportunity, self).case_close(cr, uid, ids, args)
- value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
+ data_obj = self.pool.get('ir.model.data')
+ data_id = data_obj._get_id(cr, uid, 'crm', 'stage_lead6')
+ stage_id = data_obj.browse(cr, uid, data_id).res_id
+ stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage_id)
+ value = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id}
+ if stage_obj.on_change:
+ value.update({'probability': stage_obj.probability})
- res = self.write(cr, uid, ids, value)
+ self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
opp = self.browse(cr, uid, id)
if opp.type == 'opportunity':
@@ -110,7 +122,7 @@ class crm_opportunity(osv.osv):
@param *args: Tuple Value for additional Params
"""
res = super(crm_opportunity, self).case_reset(cr, uid, ids, *args)
- self.write(cr, uid, ids, {'stage_id': False})
+ self.write(cr, uid, ids, {'stage_id': False, 'probability': 0.0})
return res
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py
index 77748adf017..84490de2b53 100644
--- a/addons/fetchmail/fetchmail.py
+++ b/addons/fetchmail/fetchmail.py
@@ -150,6 +150,7 @@ class email_server(osv.osv):
context.update({'get_server': True})
for server in self.browse(cr, uid, ids, context):
count = 0
+ user = server.user_id.id or uid
try:
if server.type == 'imap':
imap_server = self.button_confirm_login(cr, uid, [server.id], context=context)
@@ -157,7 +158,7 @@ class email_server(osv.osv):
result, data = imap_server.search(None, '(UNSEEN)')
for num in data[0].split():
result, data = imap_server.fetch(num, '(RFC822)')
- res_id = email_tool.process_email(cr, uid, server.object_id.model, data[0][1], attach=server.attach, context=context)
+ res_id = email_tool.process_email(cr, user, server.object_id.model, data[0][1], attach=server.attach, context=context)
if res_id and server.action_id:
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
@@ -174,7 +175,7 @@ class email_server(osv.osv):
for num in range(1, numMsgs + 1):
(header, msges, octets) = pop_server.retr(num)
msg = '\n'.join(msges)
- res_id = email_tool.process_email(cr, uid, server.object_id.model, msg, attach=server.attach, context=context)
+ res_id = email_tool.process_email(cr, user, server.object_id.model, msg, attach=server.attach, context=context)
if res_id and server.action_id:
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml
index ecdb4acfb3b..394761c09df 100644
--- a/addons/fetchmail/fetchmail_view.xml
+++ b/addons/fetchmail/fetchmail_view.xml
@@ -48,6 +48,7 @@
+
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 15c90caa6f4..a543b64bac9 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -225,6 +225,9 @@
widget="float_time"
attrs="{'readonly':[('state','!=','draft')]}"
on_change="onchange_planned(planned_hours, effective_hours)"/>
+