← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-trunk-crm-imp-final-phonecall_stage_imp-uco into lp:~openerp-dev/openobject-addons/trunk-trunk-crm-imp-final

 

Ujjvala Collins (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-trunk-crm-imp-final-phonecall_stage_imp-uco into lp:~openerp-dev/openobject-addons/trunk-trunk-crm-imp-final.

Requested reviews:
  OpenERP R&D Addons Team 1 (openerp-dev-addons1)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-trunk-crm-imp-final-phonecall_stage_imp-uco/+merge/58230

One object : call
Remove inbound, outbound everywhere : in title of windows, action 
we keep only the data for categ_id

State chart of phonecall
DRAFT : state, 
open : the action require by the transition
    |=> held => DONE
    |=> not held => PENDING   
    |=> open => TODO => ..

DRAFT 
|=>  open => TODO 
|=> held => DONE             
DRAFT, TODO, PENDING => cancel => CANCELLED
CANCELLED => reset to draft => DRAFT

Two menu item
      Log a call : lead to the list view (editable) and by default the state of new record is done, and show only record with state = done
      Schedule a call : lead to the list view not editable, by default the state = todo for new record, and the search default is state = todo
      In lead/opp/meeting the button schedule a call lead to the form view with state = todo by default
      New spec for the wizard schedule/log a call
        * http://pad.openerp.com/wizard-call
        * Category field should not be a required field on the "Schedule/Log Call" wizard. 
           * Default value : Schedule a phone call
        * One more Check box : Action on the top : (Schedule,  log) 
           * Schedule create the meeting in todo state
           * Log create the meeting in done state

View modification
The list view is editable if action is "Log a call"
In form view
    Duration is never required !!!!
    Button displayed depend on the state 
        DRAFT : open, held
        TODO : held, not held
        PENDING : open, held
        CANCELLED : reset to draft
        DONE : Nothing, no button displayed
    The view is the same for all phone call but change on attrs

Category of phone call, we don't change anything, we keep inbound and outbound (but it's the only place where those word appear) and catégory shouldn't be use in the code, it's just an informative field for user

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-trunk-crm-imp-final-phonecall_stage_imp-uco/+merge/58230
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-trunk-crm-imp-final.
=== modified file 'crm/crm_phonecall.py'
--- crm/crm_phonecall.py	2011-01-31 13:29:31 +0000
+++ crm/crm_phonecall.py	2011-04-19 05:45:52 +0000
@@ -53,8 +53,8 @@
                                     ('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 @@
         '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, 
     }

=== modified file 'crm/crm_phonecall_demo.xml'
--- crm/crm_phonecall_demo.xml	2011-01-14 00:11:01 +0000
+++ crm/crm_phonecall_demo.xml	2011-04-19 05:45:52 +0000
@@ -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@xxxxxxxxx&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"/>

=== modified file 'crm/crm_phonecall_menu.xml'
--- crm/crm_phonecall_menu.xml	2011-01-27 09:49:39 +0000
+++ crm/crm_phonecall_menu.xml	2011-04-19 05:45:52 +0000
@@ -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','!=','done')]</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" />
 

=== modified file 'crm/crm_phonecall_view.xml'
--- crm/crm_phonecall_view.xml	2011-01-17 22:22:19 +0000
+++ crm/crm_phonecall_view.xml	2011-04-19 05:45:52 +0000
@@ -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,83 +120,21 @@
                         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 -->
+    <!--Logged Phonecalls Tree View -->
 
     <record model="ir.ui.view" id="crm_case_inbound_phone_tree_view">
-        <field name="name">CRM - Inbound Phone Calls Tree</field>
+        <field name="name">CRM - Logged Phone Calls Tree</field>
         <field name="model">crm.phonecall</field>
         <field name="type">tree</field>
         <field name="arch" type="xml">
-            <tree string="Phone Calls" colors="grey:state in ('cancel','done');blue:state in ('pending',)" editable="top">
+            <tree string="Phone Calls" editable="top">
                 <field name="date"/>
                 <field name="name"/>
                 <field name="partner_id"
@@ -217,11 +155,10 @@
                     type="action"  />
                 <button string="Convert to Opportunity"
                     name="%(phonecall2opportunity_act)d"
-                    states="draft,open,pending"
                     icon="gtk-index"
                     type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}" />
                 <button string="Meeting"
-                    states="draft,open,pending" icon="gtk-redo"
+                     icon="gtk-redo"
                      name="action_make_meeting" type="object" />
             </tree>
         </field>

=== modified file 'crm/wizard/crm_opportunity_to_phonecall.py'
--- crm/wizard/crm_opportunity_to_phonecall.py	2011-01-14 09:34:28 +0000
+++ crm/wizard/crm_opportunity_to_phonecall.py	2011-04-19 05:45:52 +0000
@@ -33,9 +33,10 @@
         'user_id' : fields.many2one('res.users', "Assign To"),
         'date': fields.datetime('Date' , required=True),
         'section_id': fields.many2one('crm.case.section', 'Sales Team'),
-        'categ_id': fields.many2one('crm.case.categ', 'Category', required=True, \
+        'categ_id': fields.many2one('crm.case.categ', 'Category',  \
                         domain="['|',('section_id','=',False),('section_id','=',section_id),\
-                        ('object_id.model', '=', 'crm.phonecall')]"), 
+                        ('object_id.model', '=', 'crm.phonecall')]"),
+        'action': fields.selection([('schedule','Schedule a call'), ('log','Log a call')], 'Action', required=True), 
     }
 
     def default_get(self, cr, uid, fields, context=None):
@@ -58,6 +59,7 @@
 
         record_ids = context and context.get('active_ids', []) or []
         res = super(crm_opportunity2phonecall, self).default_get(cr, uid, fields, context=context)
+        res.update({'action': 'schedule'})
         for opp in opp_obj.browse(cr, uid, record_ids, context=context):
             if 'name' in fields:
                 res.update({'name': opp.name})
@@ -112,7 +114,7 @@
 
         for this in self.browse(cr, uid, ids, context=context):
             for opp in opp_obj.browse(cr, uid, record_ids, context=context):
-                new_case = phonecall_obj.create(cr, uid, {
+                vals = {
                         'name' : opp.name,
                         'case_id' : opp.id ,
                         'user_id' : this.user_id and this.user_id.id or False,
@@ -126,9 +128,12 @@
                         'partner_mobile' : opp.partner_address_id and opp.partner_address_id.mobile or False,
                         'priority': opp.priority,
                         'opportunity_id': opp.id
-                }, context=context)
-
-                phonecall_obj.case_open(cr, uid, [new_case])
+                }
+                new_case = phonecall_obj.create(cr, uid, vals, context=context)
+                if this.action == 'schedule':
+                    phonecall_obj.case_open(cr, uid, [new_case])
+                elif this.action == 'log':
+                    phonecall_obj.case_close(cr, uid, [new_case])
 
             value = {
                 'name': _('Phone Call'),

=== modified file 'crm/wizard/crm_opportunity_to_phonecall_view.xml'
--- crm/wizard/crm_opportunity_to_phonecall_view.xml	2011-01-14 00:11:01 +0000
+++ crm/wizard/crm_opportunity_to_phonecall_view.xml	2011-04-19 05:45:52 +0000
@@ -9,8 +9,10 @@
             <field name="model">crm.opportunity2phonecall</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
-                <form string="Schedule a PhoneCall">
-                    <separator string="Schedule a PhoneCall" colspan="4"/>
+                <form string="Register a PhoneCall">
+                    <separator string="Register a PhoneCall" colspan="4"/>
+                    <field name="action"/>
+                    <separator string="PhoneCall Details" colspan="4"/>
                     <field name="name"/>
                     <field name="date" string="Planned Date"/>
                     <newline/>
@@ -30,7 +32,7 @@
 		<!-- Opportunity to Phonecall action -->
 
  		<record model="ir.actions.act_window" id="opportunity2phonecall_act">
-            <field name="name">Schedule Call</field>
+            <field name="name">Schedule/Log Call</field>
             <field name="res_model">crm.opportunity2phonecall</field>
             <field name="view_type">form</field>
             <field name="view_mode">form</field>


Follow ups