[IMP] crm: dynamic_help
bzr revid: chm@openerp.com-20130205161002-3dxect9a9x43852z
This commit is contained in:
parent
a58fb0df5c
commit
bfcbb3f619
|
@ -84,6 +84,30 @@ class crm_lead(base_stage, format_address, osv.osv):
|
|||
},
|
||||
}
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
alias_txt = ""
|
||||
if context.get('default_section_id'):
|
||||
project_id = self.pool.get('crm.case.section').browse(cr, uid, context.get('default_section_id'), context=context)
|
||||
alias = project_id.alias_id and project_id.alias_id.name_get() or False
|
||||
if alias and alias[0] and alias[0][1]:
|
||||
alias_txt = alias[0][1]
|
||||
else:
|
||||
model_id = self.pool.get('ir.model').search(cr, uid, [("model", "=", self._name)], context=context)[0]
|
||||
alias_obj = self.pool.get('mail.alias')
|
||||
alias_nb = 0
|
||||
alias_ids = alias_obj.search(cr, uid, [("alias_model_id", "=", model_id)], context=context, limit=5)
|
||||
if alias_ids:
|
||||
for alias in alias_obj.browse(cr, uid, alias_ids, context=context):
|
||||
email = "%s@%s" % (alias.alias_name, alias.alias_domain)
|
||||
alias_txt = "%s%s%s" % (alias_txt, (alias_nb and ", " or " "), email)
|
||||
alias_nb += 1
|
||||
if alias_txt:
|
||||
if context.get('default_type', False) == "opportunity":
|
||||
help = "%s %s" % (help, _("<div class='oe_view_nocontent_create_alias'>You can also create opportunities by sending an email to: <b>%s</b></div>" % alias_txt))
|
||||
else:
|
||||
help = "%s %s" % (help, _("<div class='oe_view_nocontent_create_alias'>You can also create lead by sending an email to: <b>%s</b></div>" % alias_txt))
|
||||
return help
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
|
|
@ -908,7 +908,7 @@ class task(base_stage, osv.osv):
|
|||
alias_txt = "%s%s%s" % (alias_txt, (alias_nb and ", " or " "), email)
|
||||
alias_nb += 1
|
||||
if alias_txt:
|
||||
help = "%s %s" % (help, _("<div class='oe_view_nocontent_create_alias'>You can also create documents by sending an email to: <b>%s</b></div>" % alias_txt))
|
||||
help = "%s %s" % (help, _("<div class='oe_view_nocontent_create_alias'>You can also create tasks by sending an email to: <b>%s</b></div>" % alias_txt))
|
||||
return help
|
||||
|
||||
# ----------------------------------------
|
||||
|
|
Loading…
Reference in New Issue