[MERGE] Merge crm improvement and bug fix

bzr revid: sbh@tinyerp.com-20101206123415-uz8j8vskuujd6gwi
This commit is contained in:
Sbh (OpenERP)
2010-12-06 18:04:15 +05:30
4 changed files with 23 additions and 6 deletions
+16 -4
View File
@@ -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
+3 -2
View File
@@ -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]})
+1
View File
@@ -48,6 +48,7 @@
<group col="2" colspan="2">
<separator string="Auto Reply?" colspan="2"/>
<field name="action_id"/>
<field name="user_id"/>
</group>
<group col="2" colspan="2">
<separator string="Process Parameter" colspan="2"/>
+3
View File
@@ -225,6 +225,9 @@
widget="float_time"
attrs="{'readonly':[('state','!=','draft')]}"
on_change="onchange_planned(planned_hours, effective_hours)"/>
<field
name="effective_hours"
widget="float_time" invisible="1"/>
</group>
<group col="3" colspan="2">
<field name="remaining_hours" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" colspan="2"/>