[IMP] project: use dynamic_help to add alias on help
bzr revid: chm@openerp.com-20130204150058-x2erdwbt71d1lz1p
This commit is contained in:
parent
18da8cdc5b
commit
bd8cefa073
|
@ -11,8 +11,7 @@
|
|||
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
|
||||
<field name="context">{
|
||||
'default_type':'lead',
|
||||
'stage_type':'lead',
|
||||
'help_alias': {'type': 'lead'}
|
||||
'stage_type':'lead'
|
||||
}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
|
@ -51,8 +50,7 @@
|
|||
<field name="context">{
|
||||
'stage_type': 'opportunity',
|
||||
'default_type': 'opportunity',
|
||||
'default_user_id': uid,
|
||||
'help_alias': {'type': 'lead'}
|
||||
'default_user_id': uid
|
||||
}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
<field name="res_model">crm.lead</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">['|', ('type','=','lead'), ('type','=',False)]</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_leads"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
|
||||
<field name="context">{
|
||||
'search_default_section_id': [active_id], 'default_section_id': active_id, 'search_default_new': True, 'search_default_open': True, 'help_alias': {'type': "lead", 'section_id': active_id}
|
||||
'search_default_section_id': [active_id], 'default_section_id': active_id, 'default_type':'lead', 'stage_type':'lead'
|
||||
}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
|
@ -27,32 +29,67 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_leads_salesteams_all">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_leads"/>
|
||||
<field name="act_window_id" ref="crm_case_form_view_salesteams_lead"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_leads_salesteams_all">
|
||||
<field name="sequence" eval="3"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_case_form_view_leads"/>
|
||||
<field name="act_window_id" ref="crm_case_form_view_salesteams_lead"/>
|
||||
</record>
|
||||
|
||||
<!-- CRM opportunity search by Salesteams -->
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_form_view_salesteams_opportunity">
|
||||
<field name="name">Leads</field>
|
||||
<field name="name">Opportunities</field>
|
||||
<field name="res_model">crm.lead</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="view_mode">kanban,tree,graph,form,calendar</field>
|
||||
<field name="domain">[('type','=','opportunity')]</field>
|
||||
<field name="view_id" ref="crm.crm_case_kanban_view_leads"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
|
||||
<field name="context">{
|
||||
'search_default_section_id': [active_id], 'default_section_id': active_id, 'search_default_new': True, 'search_default_open': True, 'help_alias': {'type': "lead", 'section_id': active_id}
|
||||
'search_default_section_id': [active_id], 'default_section_id': active_id, 'stage_type': 'opportunity', 'default_type': 'opportunity', 'default_user_id': uid
|
||||
}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new lead.
|
||||
Click to create a new opportunity.
|
||||
</p><p>
|
||||
Use leads if you need a qualification step before creating an
|
||||
opportunity or a customer. It can be a business card you received,
|
||||
a contact form filled in your website, or a file of unqualified
|
||||
prospects you import, etc.
|
||||
OpenERP helps you keep track of your sales pipeline to follow
|
||||
up potential sales and better forecast your future revenues.
|
||||
</p><p>
|
||||
Once qualified, the lead can be converted into a business
|
||||
opportunity and/or a new customer in your address book.
|
||||
You will be able to plan meetings and phone calls from
|
||||
opportunities, convert them into quotations, attach related
|
||||
documents, track all discussions, and much more.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_kanban_view_salesteams_oppor11">
|
||||
<field name="sequence" eval="0"/>
|
||||
<field name="view_mode">kanban</field>
|
||||
<field name="view_id" ref="crm_case_kanban_view_leads"/>
|
||||
<field name="act_window_id" ref="crm_case_form_view_salesteams_opportunity"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_salesteams_oppor11">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_oppor"/>
|
||||
<field name="act_window_id" ref="crm_case_form_view_salesteams_opportunity"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_salesteams_oppor11">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_case_form_view_oppor"/>
|
||||
<field name="act_window_id" ref="crm_case_form_view_salesteams_opportunity"/>
|
||||
</record>
|
||||
|
||||
<!-- Case Sections Salesteams kanban view -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_section_salesteams_view_kanban">
|
||||
|
@ -65,7 +102,6 @@
|
|||
<field name="member_ids"/>
|
||||
<field name="note"/>
|
||||
<field name="alias_id"/>
|
||||
<field name="alias_domain"/>
|
||||
<field name="number_lead"/>
|
||||
<field name="number_opportunity"/>
|
||||
<templates>
|
||||
|
@ -80,7 +116,7 @@
|
|||
</div>
|
||||
<div class="oe_kanban_content">
|
||||
<h4><field name="name"/></h4>
|
||||
<div class="oe_kanban_crm_salesteams_alias" t-if="record.alias_id.raw_value and record.alias_id.value.match(/@.+/)">
|
||||
<div class="oe_kanban_crm_salesteams_alias" t-if="record.alias_id.value">
|
||||
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
|
||||
</div>
|
||||
<div class="oe_kanban_crm_salesteams_list">
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
<field name="context">{
|
||||
'search_default_partner_id': active_id,
|
||||
'stage_type': 'opportunity',
|
||||
'default_type': 'opportunity',
|
||||
'help_alias': {'type': 'lead'}
|
||||
'default_type': 'opportunity'
|
||||
}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<field name="view_mode">kanban,tree,form,graph,calendar</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_crm_case_jobs_filter"/>
|
||||
<field name="context">{'help_alias': {}}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to add a new job applicant.
|
||||
|
|
|
@ -118,8 +118,13 @@ class mail_alias(osv.Model):
|
|||
mail catchall domain from config.
|
||||
e.g. `jobs@openerp.my.openerp.com` or `sales@openerp.my.openerp.com`
|
||||
"""
|
||||
return [(record['id'], "%s@%s" % (record['alias_name'], record['alias_domain']))
|
||||
for record in self.read(cr, uid, ids, ['alias_name', 'alias_domain'], context=context)]
|
||||
res = []
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
if record.alias_name and record.alias_domain:
|
||||
res.append((record['id'], "%s@%s" % (record.alias_name, record.alias_domain)))
|
||||
else:
|
||||
res.append((record['id'], False))
|
||||
return res
|
||||
|
||||
def _find_unique(self, cr, uid, name, context=None):
|
||||
"""Find a unique alias name similar to ``name``. If ``name`` is
|
||||
|
@ -197,51 +202,3 @@ class mail_alias(osv.Model):
|
|||
model_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', model_name)], context=context)[0]
|
||||
vals['alias_model_id'] = model_id
|
||||
return self.create(cr, uid, vals, context=context)
|
||||
|
||||
def get_alias(self, cr, uid, model, alias_defaults={}, context=None):
|
||||
"""Return the mail alias for a document (or the default mail alias of the model)
|
||||
This method is used by the web client (method web.view.insert_alias)
|
||||
Arguments:
|
||||
model (model OpenERP)
|
||||
alias_defaults (A Python dictionary to provide default values when creating new records for this alias.)
|
||||
"""
|
||||
model_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', model)], context=context)[0]
|
||||
|
||||
result = []
|
||||
# get the value with required attribute
|
||||
domain = [('alias_model_id', '=', model_id)]
|
||||
if alias_defaults:
|
||||
for item in alias_defaults.items():
|
||||
domain += ['|', '|', '|',
|
||||
('alias_defaults', 'like', ("%%'%s': %s%%" % (item[0], item[1]))),
|
||||
('alias_defaults', 'like', ("%%'%s':%s%%" % (item[0], item[1]))),
|
||||
('alias_defaults', 'like', ("%%'%s': '%s'%%" % (item[0], item[1]))),
|
||||
('alias_defaults', 'like', ("%%'%s':'%s'%%" % (item[0], item[1])))]
|
||||
else:
|
||||
domain += [('alias_defaults', 'like', "{}")]
|
||||
|
||||
ids = self.search(cr, uid, domain, context=context)
|
||||
if ids:
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
test = True
|
||||
if alias_defaults:
|
||||
for item in ast.literal_eval(record.alias_defaults).items():
|
||||
if alias_defaults.get(item[0]) == None or alias_defaults.get(item[0]) != item[1]:
|
||||
test = False
|
||||
continue
|
||||
if test:
|
||||
result.append( {'id': record.id, 'email': "%s@%s" % (record.alias_name, record.alias_domain), 'global': False})
|
||||
|
||||
# get the default value
|
||||
if alias_defaults:
|
||||
domain = [('alias_model_id', '=', model_id)]
|
||||
for item in alias_defaults.items():
|
||||
domain += [
|
||||
('alias_defaults', 'not like', ("%%'%s'%%" % (item[0])))]
|
||||
|
||||
ids = self.search(cr, uid, domain, context=context)
|
||||
if ids:
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
result.append( {'id': record.id, 'email': "%s@%s" % (record.alias_name, record.alias_domain), 'global': True})
|
||||
|
||||
return result
|
||||
|
|
|
@ -887,8 +887,18 @@ class task(base_stage, osv.osv):
|
|||
for f in res['fields']:
|
||||
if 'Hours' in res['fields'][f]['string']:
|
||||
res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def dynamic_help(self, cr, uid, help, context=None):
|
||||
if context.get('default_project_id'):
|
||||
project_id = self.pool.get('project.project').browse(cr, uid, context.get('default_project_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]:
|
||||
help = "%s%s" % (help, _("<div>You can also create documents by sending an email to: %s</div>" % alias[0][1]))
|
||||
return help
|
||||
|
||||
# ----------------------------------------
|
||||
# Case management
|
||||
# ----------------------------------------
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
<field name="context">{
|
||||
'search_default_project_id': [active_id],
|
||||
'default_project_id': active_id,
|
||||
'help_alias': {'project_id': active_id}
|
||||
}</field>
|
||||
<field name="search_view_id" ref="view_task_search_form"/>
|
||||
<field name="help" type="html">
|
||||
|
@ -232,7 +231,6 @@
|
|||
<field name="color"/>
|
||||
<field name="task_count"/>
|
||||
<field name="alias_id"/>
|
||||
<field name="alias_domain"/>
|
||||
<field name="doc_count"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
|
@ -247,7 +245,7 @@
|
|||
</div>
|
||||
<div class="oe_kanban_content">
|
||||
<h4><field name="name"/></h4>
|
||||
<div class="oe_kanban_project_alias" t-if="record.alias_id.raw_value and record.alias_id.value.match(/@.+/)">
|
||||
<div class="oe_kanban_project_alias" t-if="record.alias_id.value">
|
||||
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
|
||||
</div>
|
||||
<div class="oe_kanban_project_list">
|
||||
|
@ -617,7 +615,6 @@
|
|||
<field name="res_model">project.task</field>
|
||||
<field name="view_mode">kanban,tree,form,calendar,gantt,graph</field>
|
||||
<field name="search_view_id" ref="view_task_search_form"/>
|
||||
<field name="context">{'help_alias': {}}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new task.
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
<field name="view_id" eval="False"/>
|
||||
<field name="domain" eval=""/>
|
||||
<field name="search_view_id" ref="view_project_issue_filter"/>
|
||||
<field name="context">{
|
||||
'help_alias': {}
|
||||
}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to report a new issue.
|
||||
|
|
|
@ -303,8 +303,7 @@
|
|||
<field name="view_mode">kanban,tree,form,calendar,graph</field>
|
||||
<field name="context">{
|
||||
'search_default_project_id': [active_id],
|
||||
'default_project_id': active_id,
|
||||
'help_alias': {'project_id': active_id}
|
||||
'default_project_id': active_id
|
||||
}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
|
|
Loading…
Reference in New Issue