From ee833e8296fbe013e0d95ca09da4fd13f2620468 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Mon, 19 Jul 2010 16:03:04 +0530 Subject: [PATCH] [IMP]: crm: If we manually assign a partner in the geo assign tab, it should update the "assignation date" automatically bzr revid: rpa@tinyerp.com-20100719103304-rb8j490srt9xc611 --- addons/crm/crm_opportunity.py | 13 +++++++++++++ addons/crm/crm_opportunity_view.xml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index 5869f94e72e..1b7658a1ff9 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -150,6 +150,19 @@ class crm_opportunity(osv.osv): return {'value':{}} return {'value':{'probability': stage.probability}} + def onchange_assign_id(self, cr, uid, ids, partner_assigned_id, context={}): + """This function updates the "assignation date" automatically, when manually assign a partner in the geo assign tab + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: List of stage’s IDs + @stage_id: change state id on run time """ + + if not partner_assigned_id: + return {'value':{'date_assign': False}} + else: + return {'value':{'date_assign': time.strftime('%Y-%m-%d')}} + _defaults = { 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c), 'priority': crm.AVAILABLE_PRIORITIES[2][0], diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml index 406ec2eefd7..894a4e86ea3 100644 --- a/addons/crm/crm_opportunity_view.xml +++ b/addons/crm/crm_opportunity_view.xml @@ -182,7 +182,7 @@ - +