[IMP]: Improved phonecall views. It'll work according to states rather than type (inbound/outbound).

bzr revid: uco@tinyerp.com-20110414115733-ushwf53kxnsl29xc
This commit is contained in:
Ujjvala Collins (OpenERP) 2011-04-14 17:27:33 +05:30
parent 1766a24b0e
commit 7400125377
4 changed files with 27 additions and 81 deletions

View File

@ -53,8 +53,8 @@ class crm_phonecall(crm_case, osv.osv):
('draft', 'Draft'),
('open', 'Todo'),
('cancel', 'Cancelled'),
('done', 'Done'),
('pending', 'Pending'),
('done', 'Held'),
('pending', 'Not Held'),
], 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
@ -83,10 +83,15 @@ class crm_phonecall(crm_case, osv.osv):
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
def _get_default_state(self, cr, uid, context=None):
if context and context.get('default_state', False):
return context.get('default_state')
return 'open'
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'priority': crm.AVAILABLE_PRIORITIES[2][0],
'state': 'open',
'state': _get_default_state,
'user_id': lambda self,cr,uid,ctx: uid,
'active': 1,
}

View File

@ -18,6 +18,7 @@
<field name="categ_id" ref="crm.categ_phone1"/>
<field eval="&quot;(769) 703-274&quot;" name="partner_phone"/>
<field eval="2.3" name="duration"/>
<field eval="&quot;done&quot;" name="state"/>
</record>
<record id="crm_case_phone02" model="crm.phonecall">
<field name="partner_address_id" ref="base.res_partner_address_6"/>
@ -33,6 +34,7 @@
<field name="categ_id" ref="crm.categ_phone1"/>
<field eval="&quot;(956) 293-2595&quot;" name="partner_phone"/>
<field eval="1.5" name="duration"/>
<field eval="&quot;done&quot;" name="state"/>
</record>
<record id="crm_case_phone03" model="crm.phonecall">
<field name="partner_address_id" ref="base.res_partner_address_2"/>
@ -49,6 +51,7 @@
<field eval="&quot;(079) 681-2139&quot;" name="partner_phone"/>
<field eval="&quot;contact@tecsas.fr&quot;" name="email_from"/>
<field eval="5.0" name="duration"/>
<field eval="&quot;done&quot;" name="state"/>
</record>
<record id="crm_case_phone04" model="crm.phonecall">
<field eval="time.strftime('%Y-%m-21 14:10:23')" name="date"/>

View File

@ -61,15 +61,15 @@
parent="base.menu_base_partner" sequence="4" />
<record model="ir.actions.act_window" id="crm_case_categ_phone_incoming0">
<field name="name">Inbound</field>
<field name="name">Log a call</field>
<field name="res_model">crm.phonecall</field>
<field name="view_type">form</field>
<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" eval="'{\'search_default_section_id\':section_id, \'default_state\':\'open\', \'search_default_current\':1,\'search_default_today\':1, \'default_categ_id\': ' + str(ref('categ_phone1')) +'}'"/>
<field name="view_id" ref="crm_case_inbound_phone_tree_view"/>
<field name="domain">[('state','=','done')]</field>
<field name="context" eval="'{\'search_default_section_id\':section_id, \'default_state\':\'done\', \'search_default_today\':1}'"/>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
<field name="help">The Inbound Calls tool allows you to log your inbound calls on the fly. Each call you get will appear on the partner form to trace every contact you have with a partner. From the phone call form, you can trigger a request for another call, a meeting or an opportunity.</field>
<field name="help">This tool allows you to log your inbound calls on the fly. Each call you get will appear on the partner form to trace every contact you have with a partner. From the phone call form, you can trigger a request for another call, a meeting or an opportunity.</field>
</record>
@ -90,24 +90,24 @@
<record model="ir.actions.act_window.view" id="action_crm_tag_form_phone_incoming0">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_inbound_phone_form_view"/>
<field name="view_id" ref="crm_case_phone_form_view"/>
<field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
</record>
<menuitem name="Inbound" id="menu_crm_case_phone_inbound"
<menuitem name="Log a call" id="menu_crm_case_phone_inbound"
parent="crm.menu_crm_case_phone"
action="crm_case_categ_phone_incoming0" />
<record model="ir.actions.act_window" id="crm_case_categ_phone_outgoing0">
<field name="name">Outbound</field>
<field name="name">Schedule a call</field>
<field name="res_model">crm.phonecall</field>
<field name="view_type">form</field>
<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" eval="'{\'search_default_section_id\':section_id, \'default_state\':\'open\', \'search_default_current\':1, \'default_categ_id\': ' + str(ref('categ_phone2')) +'}'"/>
<field name="domain">[('state','=','open')]</field>
<field name="context" eval="'{\'search_default_section_id\':section_id, \'default_state\':\'open\', \'search_default_current\':1,\'search_default_today\':1}'"/>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
<field name="help">Outbound Calls list all the calls to be done by your sales team. A salesman can record the information about the call in the form view. This information will be stored in the partner form to trace every contact you have with a customer. You can also import a .CSV file with a list of calls to be done by your sales team.</field>
<field name="help">Schedule a call lists all the calls to be done by your sales team. A salesman can record the information about the call in the form view. This information will be stored in the partner form to trace every contact you have with a customer. You can also import a .CSV file with a list of calls to be done by your sales team.</field>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_outgoing0">
@ -131,7 +131,7 @@
<field name="act_window_id" ref="crm_case_categ_phone_outgoing0"/>
</record>
<menuitem name="Outbound" id="menu_crm_case_phone_outbound"
<menuitem name="Schedule a call" id="menu_crm_case_phone_outbound"
parent="crm.menu_crm_case_phone"
action="crm_case_categ_phone_outgoing0" />

View File

@ -43,7 +43,7 @@
name="action_make_meeting" type="object" />
<field name="state"/>
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/>
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/>
<button name="case_open" string="Todo" states="draft,pending" type="object" icon="gtk-go-forward"/>
<button name="case_close" string="Held" states="open,draft,pending" type="object" icon="gtk-jump-to"/>
<button name="case_pending" string="Not Held" states="open" type="object" icon="gtk-media-pause"/>
</tree>
@ -61,7 +61,7 @@
<group colspan="6" col="7">
<field name="name" required="1"/>
<field name="partner_phone"/>
<field name="duration" widget="float_time" required="1"/>
<field name="duration" widget="float_time"/>
<button string="Schedule a Meeting" name="action_make_meeting" icon="gtk-redo" type="object"/>
<field name="date" required="1"/>
@ -111,7 +111,7 @@
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
<button name="case_open" string="Open"
<button name="case_open" string="Todo"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_pending" string="Not Held"
@ -120,75 +120,13 @@
states="open,draft,pending" type="object"
icon="gtk-jump-to" />
<button name="case_reset" string="Reset to Draft"
states="done,cancel" type="object"
states="cancel" type="object"
icon="gtk-convert" />
</group>
</form>
</field>
</record>
<!--Inbound Phonecalls Form View -->
<record model="ir.ui.view" id="crm_case_inbound_phone_form_view">
<field name="name">CRM - Inbound Phone Call Form</field>
<field name="model">crm.phonecall</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Phone Call">
<group colspan="4" col="7">
<field name="name" required="1"/>
<field name="partner_phone"/>
<field name="duration" widget="float_time"/>
<button string="Schedule a Meeting"
name="action_make_meeting"
icon="gtk-redo"
type="object" />
<field name="date" required="1"/>
<field name="user_id"/>
<field name="section_id" colspan="1" widget="selection" />
<button string="Convert to Opportunity"
name="%(phonecall2opportunity_act)d"
icon="gtk-index" type="action"
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<label colspan="6" string=""/>
<button string="Schedule Other Call"
icon="terp-call-start"
name="%(phonecall_to_phonecall_act)d"
type="action" />
</group>
<group col="3" colspan="2">
<separator colspan="3" string="Contacts" />
<field name="partner_id"
on_change="onchange_partner_id(partner_id, email_from)" />
<button string="Create a Partner"
icon="terp-partner"
name="%(action_crm_phonecall2partner)d"
type="action"
attrs="{'invisible':[('partner_id','!=',False)]}"
groups="base.group_partner_manager" />
<newline/>
<field name="partner_address_id"
on_change="onchange_partner_address_id(partner_address_id, email_from)" />
<newline/>
<field name="partner_mobile" />
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Categorization" />
<field name="categ_id" widget="selection"
domain="[('object_id.model', '=', 'crm.phonecall')]"
string="Type" />
<field name="priority"/>
<field name="opportunity_id"/>
</group>
<separator string="Description" colspan="4" />
<field name="description" nolabel="1" colspan="4" />
<separator colspan="4" />
</form>
</field>
</record>
<!--Inbound Phonecalls Tree View -->
<record model="ir.ui.view" id="crm_case_inbound_phone_tree_view">