← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-openerp_crm_imp-phonecalls_stages-rme into lp:~openerp-dev/openobject-addons/trunk-openerp_crm_imp

 

Ravindra Mekhiya(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-openerp_crm_imp-phonecalls_stages-rme into lp:~openerp-dev/openobject-addons/trunk-openerp_crm_imp.

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

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-openerp_crm_imp-phonecalls_stages-rme/+merge/55885

Hello,

    * Added a "Schedule a phone call" button on lead form view

    * rename inbound into "Log A Call" 

    * rename outbound into "Schedules Calls"

    * remove (hide) stage from lead

    * Improve Tooltip on Change Probability Automatically (Satges) : If checked, OpenERP will set the probability of the opportunity to the probability defined in the stage. If you set a probability of 0%/100% on check the 'Change Probability Automatically' field, OpenERP will assign this stage when the opportunity is marked as Lost/Won.

Thanks.

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-openerp_crm_imp-phonecalls_stages-rme/+merge/55885
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-openerp_crm_imp.
=== modified file 'crm/crm_phonecall.py'
--- crm/crm_phonecall.py	2011-01-31 13:29:31 +0000
+++ crm/crm_phonecall.py	2011-04-01 09:14:33 +0000
@@ -53,13 +53,13 @@
                                     ('draft', 'Draft'), 
                                     ('open', 'Todo'), 
                                     ('cancel', 'Cancelled'), 
-                                    ('done', 'Done'), 
-                                    ('pending', 'Pending'),
+                                    ('done', 'Called Log'), 
+                                    ('pending', 'Schedule Call'),
                                 ], '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\'.\
-                                  \nWhen the case is over, the state is set to \'Done\'.\
-                                  \nIf the case needs to be reviewed then the state is set to \'Pending\'.'), 
+                                  \nWhen the case is over, the state is set to \'Called Log\'.\
+                                  \nIf the case needs to be reviewed then the state is set to \'Schedule\'.'), 
         'email_from': fields.char('Email', size=128, help="These people will receive email."), 
         'date_open': fields.datetime('Opened', readonly=True),
         # phonecall fields
@@ -81,6 +81,7 @@
         'date': fields.datetime('Date'), 
         'opportunity_id': fields.many2one ('crm.lead', 'Opportunity'), 
         'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
+        'category': fields.char('Category', size=128),
     }
 
     _defaults = {
@@ -101,6 +102,13 @@
             res['value']['partner_phone'] = address.phone
             res['value']['partner_mobile'] = address.mobile
         return res
+    
+    def onchange_categ_id(self, cr, uid, ids, categ_id):
+        v={}
+        if categ_id:
+            categ = self.pool.get('crm.case.categ').browse(cr, uid, categ_id)
+            v['category']=categ.name
+        return {'value': v}
 
     def case_close(self, cr, uid, ids, *args):
         """Overrides close for crm_case for setting close date
@@ -113,9 +121,14 @@
         for phone in self.browse(cr, uid, ids):
             phone_id= phone.id
             data = {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
+            phone_type_obj = self.pool.get('crm.case.categ')
+            phone_type_ids = phone_type_obj.search(cr, uid, [('name', '=', 'Log A Call')], limit=1)
+            if not phone_type_ids:
+                raise osv.except_osv(_('Error !'),
+                    _('There is no phonecall type/category "Log A Call" defined'))
             if phone.duration <=0:
                 duration = datetime.now() - datetime.strptime(phone.date, '%Y-%m-%d %H:%M:%S')
-                data.update({'duration': duration.seconds/float(60)})
+                data.update({'duration': duration.seconds/float(60), 'categ_id':phone_type_ids[0]})
             res = super(crm_phonecall, self).case_close(cr, uid, [phone_id], args)
             self.write(cr, uid, ids, data)
         return res
@@ -145,6 +158,23 @@
         self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
         return res
 
+    def case_pending(self, cr, uid, ids, *args):
+        """Marks case as pending
+        @param self: The object pointer
+        @param cr: the current row, from the database cursor,
+        @param uid: the current user’s ID for security checks,
+        @param ids: List of case Ids
+        @param *args: Tuple Value for additional Params
+        """
+        phone_type_obj = self.pool.get('crm.case.categ')
+        res = super(crm_phonecall, self).case_pending(cr, uid, ids, args)
+        phone_type_ids = phone_type_obj.search(cr, uid, [('name', '=', 'Schedule Call')], limit=1)
+        if not phone_type_ids:
+            raise osv.except_osv(_('Error !'),
+                _('There is no phonecall type/category "Schedule Call" defined'))
+        self.pool.get('crm.phonecall').write(cr, uid, ids,{'categ_id':phone_type_ids[0], 'state' : 'pending'})
+        return res
+    
     def action_make_meeting(self, cr, uid, ids, context=None):
         """
         This opens Meeting's calendar view to schedule meeting on current Phonecall

=== modified file 'crm/crm_phonecall_data.xml'
--- crm/crm_phonecall_data.xml	2011-01-14 00:11:01 +0000
+++ crm/crm_phonecall_data.xml	2011-04-01 09:14:33 +0000
@@ -5,13 +5,13 @@
     Phonecall Categories
     -->
     <record model="crm.case.categ" id="categ_phone1">
-        <field name="name">Inbound</field>
+        <field name="name">Log A Call</field>
         <field name="section_id" ref="section_sales_department"/>
         <field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
 
     </record>
     <record model="crm.case.categ" id="categ_phone2">
-        <field name="name">Outbound</field>
+        <field name="name">Schedule Call</field>
         <field name="section_id" ref="section_sales_department"/>
         <field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
     </record>

=== modified file 'crm/crm_phonecall_menu.xml'
--- crm/crm_phonecall_menu.xml	2011-03-23 12:57:57 +0000
+++ crm/crm_phonecall_menu.xml	2011-04-01 09:14:33 +0000
@@ -60,54 +60,15 @@
         groups="base.group_extended,base.group_sale_salesman"
         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="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="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>
-
-    </record>
-
-    <record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_incoming0">
-        <field name="sequence" eval="1"/>
-        <field name="view_mode">tree</field>
-        <field name="view_id" ref="crm_case_inbound_phone_tree_view"/>
-        <field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
-    </record>
-
-    <record model="ir.actions.act_window.view" id="action_crm_tag_calendar_phone_incoming0">
-        <field name="sequence" eval="2"/>
-        <field name="view_mode">calendar</field>
-        <field name="view_id" ref="crm_case_phone_calendar_view"/>
-        <field name="act_window_id" ref="crm_case_categ_phone_incoming0"/>
-    </record>
-
-    <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="act_window_id" ref="crm_case_categ_phone_incoming0"/>
-    </record>
-
-    <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">Phone Calls</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="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">Phone 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>
     </record>
 
     <record model="ir.actions.act_window.view" id="action_crm_tag_tree_phone_outgoing0">
@@ -131,7 +92,7 @@
         <field name="act_window_id" ref="crm_case_categ_phone_outgoing0"/>
     </record>
 
-    <menuitem name="Schedules Calls" id="menu_crm_case_phone_outbound"
+    <menuitem name="Phone Calls" 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-01 09:14:33 +0000
@@ -61,9 +61,10 @@
                  <group colspan="6" col="7">
                     <field name="name" required="1"/>
                     <field name="partner_phone"/>
-                    <field name="duration" widget="float_time" required="1"/>
+                    <field name="category" invisible="1"/>
+                    <field name="duration" widget="float_time"
+                    attrs="{'required':['|',('category', '=', 'Schedule Call'),('state', '=', 'pending'),('state', '!=', 'done')]}" />
                     <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" />
@@ -98,6 +99,7 @@
                 <group col="2" colspan="2">
                     <separator colspan="2" string="Categorization" />
                     <field name="categ_id" widget="selection"
+                    	on_change="onchange_categ_id(categ_id)"
                         domain="[('object_id.model', '=', 'crm.phonecall')]"
                         string="Type" />
                     <field name="priority"/>
@@ -127,105 +129,6 @@
         </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">
-        <field name="name">CRM - Inbound 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">
-                <field name="date"/>
-                <field name="name"/>
-                <field name="partner_id"
-                    on_change="onchange_partner_id(partner_id)"
-                    string="Partner" />
-                <field name="partner_address_id"
-                        on_change="onchange_partner_address_id(partner_address_id)" />
-                <field name="partner_phone"/>
-                <field name="user_id"/>
-                <field name="categ_id" widget="selection"
-                    domain="[('object_id.model', '=', 'crm.phonecall')]"
-                    string="Type" />
-                <field name="state" invisible="1"/>
-                <field name="create_date" invisible="1"/>
-                <button string="Schedule Other Call"
-                    icon="terp-call-start"
-                    name="%(phonecall_to_phonecall_act)d"
-                    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"
-                     name="action_make_meeting" type="object" />
-            </tree>
-        </field>
-    </record>
 
 <!-- Phonecalls Calendar View -->
 
@@ -290,6 +193,8 @@
                        domain="[]" context="{'group_by':'create_date'}" />
                    <filter string="Date" icon="terp-go-month" domain="[]"
                        context="{'group_by':'date'}" help="Date of Call" />
+                   <filter string="Type" icon="terp-stock_symbol-selection" domain="[]"
+                       context="{'group_by':'categ_id'}" />
                </group>
            </search>
         </field>