Mayur Maheshwari(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-configrework3-crm-working-time-remove-mma
into lp:~openerp-dev/openobject-addons/trunk-configrework3-crm.
Requested reviews:
Rucha (Open ERP) (rpa-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-configrework3-crm-working-time-remove-mma/+merge/71991
Hello,
crm: Working Time field is removed from sales team view
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-configrework3-crm-working-time-remove-mma/+merge/71991
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-configrework3-crm.
=== modified file 'crm/crm.py'
--- crm/crm.py 2011-08-03 10:06:02 +0000
+++ crm/crm.py 2011-08-18 07:19:24 +0000
@@ -689,7 +689,6 @@
'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by OpenERP about cases in this sales team"),
'parent_id': fields.many2one('crm.case.section', 'Parent Team'),
'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Teams'),
- 'resource_calendar_id': fields.many2one('resource.calendar', "Working Time"),
'note': fields.text('Description'),
'working_hours': fields.float('Working Hours', digits=(16,2 )),
'stage_ids': fields.many2many('crm.case.stage', 'section_stage_rel', 'section_id', 'stage_id', 'Stages'),
=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py 2011-07-19 09:06:02 +0000
+++ crm/crm_lead.py 2011-08-18 07:19:24 +0000
@@ -49,53 +49,22 @@
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
"""
- cal_obj = self.pool.get('resource.calendar')
- res_obj = self.pool.get('resource.resource')
res = {}
for lead in self.browse(cr, uid, ids, context=context):
for field in fields:
res[lead.id] = {}
- duration = 0
ans = False
- if field == 'day_open':
- if lead.date_open:
- date_create = datetime.strptime(lead.create_date, "%Y-%m-%d %H:%M:%S")
- date_open = datetime.strptime(lead.date_open, "%Y-%m-%d %H:%M:%S")
- ans = date_open - date_create
- date_until = lead.date_open
- elif field == 'day_close':
- if lead.date_closed:
- date_create = datetime.strptime(lead.create_date, "%Y-%m-%d %H:%M:%S")
- date_close = datetime.strptime(lead.date_closed, "%Y-%m-%d %H:%M:%S")
- date_until = lead.date_closed
- ans = date_close - date_create
- if ans:
- resource_id = False
- if lead.user_id:
- resource_ids = res_obj.search(cr, uid, [('user_id','=',lead.user_id.id)])
- if len(resource_ids):
- resource_id = resource_ids[0]
+ date_process = False
+ if field == 'day_open' and lead.date_open:
+ date_process = lead.date_open
+
+ elif field == 'day_close' and lead.date_closed:
+ date_process = lead.date_closed
- duration = float(ans.days)
- if lead.section_id and lead.section_id.resource_calendar_id:
- duration = float(ans.days) * 24
- new_dates = cal_obj.interval_get(cr,
- uid,
- lead.section_id.resource_calendar_id and lead.section_id.resource_calendar_id.id or False,
- datetime.strptime(lead.create_date, '%Y-%m-%d %H:%M:%S'),
- duration,
- resource=resource_id
- )
- no_days = []
- date_until = datetime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
- for in_time, out_time in new_dates:
- if in_time.date not in no_days:
- no_days.append(in_time.date)
- if out_time > date_until:
- break
- duration = len(no_days)
- res[lead.id][field] = abs(int(duration))
+ if date_process:
+ ans = datetime.strptime(date_process, "%Y-%m-%d %H:%M:%S") - datetime.strptime(lead.create_date, "%Y-%m-%d %H:%M:%S")
+ res[lead.id][field] = ans and ans.days or 0.0
return res
def _history_search(self, cr, uid, obj, name, args, context=None):
=== modified file 'crm/crm_view.xml'
--- crm/crm_view.xml 2011-08-03 08:16:20 +0000
+++ crm/crm_view.xml 2011-08-18 07:19:24 +0000
@@ -35,7 +35,6 @@
<field name="code" select="1"/>
<newline/>
<field name="user_id" select="2"/>
- <field name="resource_calendar_id" select="2" widget="selection"/>
<field name="active" select="2"/>
</group>
<notebook colspan="4">
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp