[IMP] code cleaning for get_empty_list_help
bzr revid: chm@openerp.com-20130321133139-k6ycur34ojw2qhjq
This commit is contained in:
parent
8f2961d6f6
commit
9d45f9ad82
|
@ -84,12 +84,12 @@ class crm_lead(base_stage, format_address, osv.osv):
|
|||
},
|
||||
}
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
def get_empty_list_help(self, cr, uid, help, context=None):
|
||||
if context.get('default_type', None) == 'lead':
|
||||
context['dynamic_help_model'] = 'crm.case.section'
|
||||
context['dynamic_help_id'] = context.get('default_section_id', None)
|
||||
context['dynamic_help_documents'] = _("leads")
|
||||
return super(crm_lead, self).dynamic_help(cr, uid, help, context=context)
|
||||
context['empty_list_help_model'] = 'crm.case.section'
|
||||
context['empty_list_help_id'] = context.get('default_section_id', None)
|
||||
context['empty_list_help_document_name'] = _("leads")
|
||||
return super(crm_lead, self).get_empty_list_help(cr, uid, help, context=context)
|
||||
|
||||
def onchange_user_id(self, cr, uid, ids, section_id, user_id, context=None):
|
||||
if user_id:
|
||||
|
|
|
@ -487,11 +487,11 @@ class hr_applicant(base_stage, osv.Model):
|
|||
"""
|
||||
return self.set_priority(cr, uid, ids, '3')
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
context['dynamic_help_model'] = 'hr.job'
|
||||
context['dynamic_help_id'] = context.get('default_job_id', None)
|
||||
context['dynamic_help_documents'] = _("job applicants")
|
||||
return super(hr_applicant, self).dynamic_help(cr, uid, help, context=context)
|
||||
def get_empty_list_help(self, cr, uid, help, context=None):
|
||||
context['empty_list_help_model'] = 'hr.job'
|
||||
context['empty_list_help_id'] = context.get('default_job_id', None)
|
||||
context['empty_list_help_document_name'] = _("job applicants")
|
||||
return super(hr_applicant, self).get_empty_list_help(cr, uid, help, context=context)
|
||||
|
||||
|
||||
class hr_job(osv.osv):
|
||||
|
|
|
@ -89,14 +89,14 @@ class mail_thread(osv.AbstractModel):
|
|||
# :param function lambda: returns whether the tracking should record using this subtype
|
||||
_track = {}
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
if not context.get('dynamic_help_model', None):
|
||||
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)
|
||||
def get_empty_list_help(self, cr, uid, help, context=None):
|
||||
if not context.get('empty_list_help_model', None):
|
||||
if context.get('empty_list_help_id', None):
|
||||
object_id = self.pool.get(context.get('empty_list_help_model')).browse(cr, uid, context.get('empty_list_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 "")
|
||||
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('empty_list_help_document_name', _("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')
|
||||
|
@ -104,10 +104,10 @@ class mail_thread(osv.AbstractModel):
|
|||
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 "")
|
||||
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('empty_list_help_document_name', _("documents")), email, email), help or "")
|
||||
|
||||
if context.get('dynamic_help_documents', None) and ("%s" % 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 "")
|
||||
if context.get('empty_list_help_document_name', None) and ("%s" % 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('empty_list_help_document_name', _("documents")), help or "")
|
||||
|
||||
return help
|
||||
|
||||
|
|
|
@ -889,11 +889,11 @@ class task(base_stage, osv.osv):
|
|||
return res
|
||||
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
context['dynamic_help_model'] = 'project.project'
|
||||
context['dynamic_help_id'] = context.get('default_project_id', None)
|
||||
context['dynamic_help_documents'] = _("tasks")
|
||||
return super(task, self).dynamic_help(cr, uid, help, context=context)
|
||||
def get_empty_list_help(self, cr, uid, help, context=None):
|
||||
context['empty_list_help_model'] = 'project.project'
|
||||
context['empty_list_help_id'] = context.get('default_project_id', None)
|
||||
context['empty_list_help_document_name'] = _("tasks")
|
||||
return super(task, self).get_empty_list_help(cr, uid, help, context=context)
|
||||
|
||||
# ----------------------------------------
|
||||
# Case management
|
||||
|
|
|
@ -412,11 +412,11 @@ class project_issue(base_stage, osv.osv):
|
|||
self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
|
||||
return res
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
context['dynamic_help_model'] = 'project.project'
|
||||
context['dynamic_help_id'] = context.get('default_project_id', None)
|
||||
context['dynamic_help_documents'] = _("issues")
|
||||
return super(project_issue, self).dynamic_help(cr, uid, help, context=context)
|
||||
def get_empty_list_help(self, cr, uid, help, context=None):
|
||||
context['empty_list_help_model'] = 'project.project'
|
||||
context['empty_list_help_id'] = context.get('default_project_id', None)
|
||||
context['empty_list_help_document_name'] = _("issues")
|
||||
return super(project_issue, self).get_empty_list_help(cr, uid, help, context=context)
|
||||
|
||||
# -------------------------------------------------------
|
||||
# Stage management
|
||||
|
|
Loading…
Reference in New Issue