[IMP] mail: dynamic_help fix false message
bzr revid: chm@openerp.com-20130320135051-bit13xz2lv18x5m9
This commit is contained in:
+16
-18
@@ -91,25 +91,23 @@ class mail_thread(osv.AbstractModel):
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
if not context.get('dynamic_help_model', None):
|
||||
return help
|
||||
if context.get('dynamic_help_id', None):
|
||||
object_id = self.pool.get(context.get('dynamic_help_model')).browse(cr, uid, context.get('dynamic_help_id'), context=context)
|
||||
alias = object_id.alias_id and object_id.alias_id.name_get() or False
|
||||
if alias and alias[0] and alias[0][1]:
|
||||
email = alias[0][1]
|
||||
return "%s %s" % (_("<p class='oe_view_nocontent_create'>Click here to add a new %s or send an email to: <a href='mailto:%s'>%s</a></p>") % (context.get('dynamic_help_documents', _("documents")), email, email), help or "")
|
||||
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_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)
|
||||
return "%s %s" % (_("<p class='oe_view_nocontent_create'>Click here to add a new %s or send an email, for example, to: <a href='mailto:%s'>%s</a></p>") % (context.get('dynamic_help_documents', _("documents")), email, email), help or "")
|
||||
|
||||
if context.get('dynamic_help_id', None):
|
||||
object_id = self.pool.get(context.get('dynamic_help_model')).browse(cr, uid, context.get('dynamic_help_id'), context=context)
|
||||
alias = object_id.alias_id and object_id.alias_id.name_get() or False
|
||||
if alias and alias[0] and alias[0][1]:
|
||||
email = alias[0][1]
|
||||
return "%s %s" % (_("<p class='oe_view_nocontent_create'>Click here to add a new %s or send an email to: <a href='mailto:%s'>%s</a></p>") % (context.get('dynamic_help_documents', _("documents")), email, email), help)
|
||||
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_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)
|
||||
return "%s %s" % (_("<p class='oe_view_nocontent_create'>Click here to add a new %s or send an email, for example, to: <a href='mailto:%s'>%s</a></p>") % (context.get('dynamic_help_documents', _("documents")), email, email), help)
|
||||
|
||||
if help.find("oe_view_nocontent_create") == -1:
|
||||
return "%s %s" % (_("<p class='oe_view_nocontent_create'>Click here to add a new %s</p>") % context.get('dynamic_help_documents', _("documents")), help)
|
||||
if context.get('dynamic_help_documents', None) and help.find("oe_view_nocontent_create") == -1:
|
||||
return "%s %s" % (_("<p class='oe_view_nocontent_create'>Click here to add a new %s</p>") % context.get('dynamic_help_documents', _("documents")), help or "")
|
||||
|
||||
return help
|
||||
|
||||
|
||||
Reference in New Issue
Block a user