[IMP] crm: improve view
bzr revid: hmo@tinyerp.com-20100304103646-cc065jh8agi178m2
This commit is contained in:
parent
bbbcb52ae2
commit
34d6796c2c
|
@ -27,17 +27,26 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Leads Form">
|
||||
<group colspan="4" col="6">
|
||||
<group colspan="4" col="7">
|
||||
<field name="partner_name" required="1"/>
|
||||
<field name="priority"/>
|
||||
<field name="date_deadline"/>
|
||||
|
||||
<button
|
||||
name="%(wizard_crm_lead_opportunity_set)d"
|
||||
string="Convert"
|
||||
help="Convert into Opportunity"
|
||||
icon="gtk-index"
|
||||
type="action"
|
||||
attrs="{'invisible':[('opportunity_id','!=',False)]}"/>
|
||||
<newline/>
|
||||
<field name="section_id" colspan="1" widget="selection"/>
|
||||
<field name="user_id"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
|
||||
|
||||
<field name="stage_id" widget="selection" readonly="1" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<group col="2" colspan="1">
|
||||
|
||||
<button name="stage_previous" string="Previous" states="open,pending" type="object" icon="gtk-go-back"/>
|
||||
<button name="stage_next" string="Next" states="open,pending" type="object" icon="gtk-go-forward"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Lead">
|
||||
|
@ -71,20 +80,14 @@
|
|||
icon="gtk-index" type="action"
|
||||
string="Create"
|
||||
attrs="{'invisible':[('partner_id','!=',False)]}"/>
|
||||
<field name="opportunity_id"/>
|
||||
<button
|
||||
name="%(wizard_crm_lead_opportunity_set)d"
|
||||
string="Convert"
|
||||
icon="gtk-index"
|
||||
type="action"
|
||||
attrs="{'invisible':[('opportunity_id','!=',False)]}"/>
|
||||
<field name="opportunity_id"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" select="2"/>
|
||||
<button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/>
|
||||
<button name="case_close" string="Close" states="open,draft,pending" type="object" icon="gtk-close"/>
|
||||
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/>
|
||||
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/>
|
||||
<button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/>
|
||||
|
@ -167,6 +170,7 @@
|
|||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/>
|
||||
<button name="case_close" string="Close" states="open,draft,pending" type="object" icon="gtk-close"/>
|
||||
<button string="Convert to Opportunity" name="%(wizard_crm_lead_opportunity_set)d" states="draft,open,pending" icon="gtk-index" type="action"/>
|
||||
<button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/>
|
||||
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/>
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
name="Meetings"
|
||||
res_model="crm.meeting"
|
||||
src_model="crm.opportunity"
|
||||
view_mode="calendar,graph"
|
||||
context="{'default_partner_id': active_id, 'default_duration': 4.0}"
|
||||
domain="[('opportunity_id','=',active_id)]"
|
||||
view_mode="calendar,tree,form"
|
||||
context="{'default_duration': 4.0}"
|
||||
domain="[('user_id','=',uid)]"
|
||||
view_type="form"/>
|
||||
|
||||
<act_window
|
||||
|
@ -19,8 +19,8 @@
|
|||
res_model="crm.phonecall"
|
||||
src_model="crm.opportunity"
|
||||
view_mode="calendar,tree,form"
|
||||
context="{'default_partner_id': active_id, 'default_duration': 1.0}"
|
||||
domain="[('opportunity_id','=',active_id)]"
|
||||
context="{'default_duration': 1.0}"
|
||||
domain="[('user_id','=',uid)]"
|
||||
view_type="form"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_category_act_oppor11">
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<field name="view_mode">tree,calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone1'))+')]'"/>
|
||||
<field name="context">{'set_editable':True}</field>
|
||||
<field name="context">{'set_editable':True,'default_state':'open'}</field>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_incoming0">
|
||||
|
@ -79,6 +79,7 @@
|
|||
<field name="view_mode">tree,calendar</field>
|
||||
<field name="view_id" ref="crm_case_phone_tree_view"/>
|
||||
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone2'))+')]'"/>
|
||||
<field name="context">{'default_state':'open'}</field>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_outgoing0">
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
<field name="name" string="Call Summary"/>
|
||||
<field name="partner_id" string="Partner"/>
|
||||
<field name="partner_contact"/>
|
||||
<field name="partner_phone"/>
|
||||
<field name="partner_mobile"/>
|
||||
<field name="partner_phone"/>
|
||||
<field name="user_id"/>
|
||||
<button string="Opportunity"
|
||||
name="%(wizard_crm_phonecall_opportunity_set)d"
|
||||
|
@ -92,11 +91,7 @@
|
|||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Categorization" />
|
||||
<field name="priority"/>
|
||||
<field name="opportunity_id"
|
||||
on_change="onchange_case_id(case_id, name, partner_id)"
|
||||
context="{'default_name':name,'default_section_id':section_id,'default_user_id':user_id,'default_duration':duration,
|
||||
'default_partner_id':partner_id,'default_partner_address_id':partner_address_id,'default_partner_phone':partner_phone,
|
||||
'default_partner_mobile':partner_mobile,'default_categ_id':categ_id}" />
|
||||
<field name="opportunity_id"/>
|
||||
</group>
|
||||
<separator string="Description" colspan="4" />
|
||||
<field name="description" nolabel="1" colspan="4" />
|
||||
|
|
|
@ -57,7 +57,7 @@ class partner_create(wizard.interface):
|
|||
'string':'Action', 'required':True, 'default': lambda *a:'exist'},
|
||||
'partner_id' : {'type':'many2one', 'relation':'res.partner', 'string':'Partner'},
|
||||
}
|
||||
|
||||
|
||||
def _selectPartner(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
case_obj = pool.get('crm.lead')
|
||||
|
@ -75,8 +75,11 @@ class partner_create(wizard.interface):
|
|||
addresses = contact_obj.browse(cr, uid, address_ids)
|
||||
partner_ids = addresses and [addresses[0].partner_id.id] or False
|
||||
|
||||
partner_id = partner_ids and partner_ids[0] or False
|
||||
return {'partner_id': partner_id}
|
||||
partner_id = partner_ids and partner_ids[0] or False
|
||||
vals = {'partner_id': partner_id}
|
||||
if not partner_id:
|
||||
vals['action'] = 'create'
|
||||
return vals
|
||||
|
||||
def _create_partner(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
|
|
|
@ -86,8 +86,7 @@ class opportunity2phonecall(wizard.interface):
|
|||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
opportunites = opportunity_case_obj.browse(cr, uid, data['ids'])
|
||||
for opportunity in opportunites:
|
||||
#TODO : Take Other Info from opportunity
|
||||
for opportunity in opportunites:
|
||||
new_case = phonecall_case_obj.create(cr, uid, {
|
||||
'name' : opportunity.name,
|
||||
'case_id' : opportunity.id,
|
||||
|
@ -96,9 +95,12 @@ class opportunity2phonecall(wizard.interface):
|
|||
'description' : form['note'],
|
||||
'date' : form['deadline'],
|
||||
'section_id' : form['section_id'],
|
||||
'partner_id': opportunity.partner_id.id,
|
||||
'partner_address_id':opportunity.partner_address_id.id,
|
||||
'partner_id': opportunity.partner_id and opportunity.partner_id.id or False,
|
||||
'partner_address_id':opportunity.partner_address_id and opportunity.partner_address_id.id or False,
|
||||
'description': data['form']['note'] or opportunity.description,
|
||||
'partner_phone' : opportunity.phone or (opportunity.partner_address_id and opportunity.partner_address_id.phone or False),
|
||||
'partner_mobile' : opportunity.partner_address_id and opportunity.partner_address_id.mobile or False,
|
||||
'priority': opportunity.priority,
|
||||
'opportunity_id':opportunity.id
|
||||
}, context=context)
|
||||
vals = {}
|
||||
|
|
|
@ -165,9 +165,9 @@ class phonecall2opportunity(partner_create):
|
|||
pool = pooler.get_pool(cr.dbname)
|
||||
case_obj = pool.get('crm.phonecall')
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
if case.state != 'open':
|
||||
if case.state in ['done', 'cancel']:
|
||||
raise wizard.except_wizard(_('Warning !'),
|
||||
_('Phone Call state should be \'Open\' before converting to Opportunity.'))
|
||||
_('Closed/Cancelled Phone Call Could not convert into Opportunity.'))
|
||||
return {}
|
||||
|
||||
def _selectopportunity(self, cr, uid, data, context):
|
||||
|
@ -200,8 +200,7 @@ class phonecall2opportunity(partner_create):
|
|||
|
||||
phonecall_case_obj = pool.get('crm.phonecall')
|
||||
opportunity_case_obj = pool.get('crm.opportunity')
|
||||
for phonecall in phonecall_case_obj.browse(cr, uid, data['ids']):
|
||||
#TODO : Take other info from phonecall
|
||||
for phonecall in phonecall_case_obj.browse(cr, uid, data['ids']):
|
||||
new_opportunity_id = opportunity_case_obj.create(cr, uid, {
|
||||
'name': data['form']['name'],
|
||||
'planned_revenue': data['form']['planned_revenue'],
|
||||
|
@ -210,7 +209,8 @@ class phonecall2opportunity(partner_create):
|
|||
'section_id': phonecall.section_id.id,
|
||||
'description': phonecall.description,
|
||||
'phonecall_id': phonecall.id,
|
||||
'priority': phonecall.priority
|
||||
'priority': phonecall.priority,
|
||||
'phone': phonecall.partner_phone,
|
||||
})
|
||||
new_opportunity = opportunity_case_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
|
|
Loading…
Reference in New Issue