[IMP] stage view : type depend on module installed, and stage view give the opportuni...
authorThibault Francois <tfr@openerp.com>
Tue, 14 Dec 2010 13:19:59 +0000 (14:19 +0100)
committerThibault Francois <tfr@openerp.com>
Tue, 14 Dec 2010 13:19:59 +0000 (14:19 +0100)
bzr revid: tfr@openerp.com-20101214131959-gzire7hxl07o1g3q

addons/crm/crm.py
addons/crm/crm_lead_view.xml
addons/crm/crm_view.xml
addons/crm_claim/crm_claim.py
addons/crm_fundraising/crm_fundraising.py

index 5336bdd..e0b32e4 100644 (file)
@@ -479,6 +479,12 @@ class crm_case_stage(osv.osv):
     _description = "Stage of case"
     _rec_name = 'name'
     _order = "sequence"
+    
+    
+    
+    def _get_type_value(self, cr, user, context):
+        return [('lead','Lead'),('opportunity','Opportunity')]
+
 
     _columns = {
         'name': fields.char('Stage Name', size=64, required=True, translate=True),
@@ -487,9 +493,10 @@ class crm_case_stage(osv.osv):
         'on_change': fields.boolean('Change Probability Automatically', \
                          help="Change Probability on next and previous stages."),
         'requirements': fields.text('Requirements'),
-        'type': fields.selection([('lead','Lead'),('opportunity','Opportunity'),('claim','Claim'), ('fundraising','Fundraising')], 'Type'),
+        'type': fields.selection(_get_type_value, 'Type'),
     }
-
+    
+    
     def _find_stage_type(self, cr, uid, context=None):
         """Finds type of stage according to object.
         @param self: The object pointer
index 979ab26..1ff9daf 100644 (file)
         <field name="context">{'type':'lead'}</field>
         <field name="help">Create specific stages that will help your sales better organise their sales pipeline by maintaining them to their leads and sales opportunities. It will allow them to easily track how is positioned a specific lead or opportunity in the sales cycle.</field>
     </record>
+    
+    <record id="action_picking_tree_out_view1_waiting" model="ir.actions.act_window.view">
+        <field eval="1" name="sequence"/>
+        <field name="view_mode">tree</field>
+        <field name="view_id" ref="crm_case_stage_tree"/>
+        <field name="act_window_id" ref="crm_lead_stage_act"/>
+    </record>
+        
+    <record id="action_stage_form_view1" model="ir.actions.act_window.view">
+       <field eval="2" name="sequence"/>
+        <field name="view_mode">form</field>
+        <field name="view_id" ref="crm_case_stage_form_full"/>
+        <field name="act_window_id" ref="crm_lead_stage_act"/>
+    </record>
 
      <menuitem action="crm_lead_stage_act" id="menu_crm_lead_stage_act" name="Stages"
         groups="base.group_extended" sequence="0"
index f0c2d55..1ae93a3 100644 (file)
                     <field name="sequence"/>
                     <field name="name"/>
                     <field name="probability"/>
+                    <field name="type" />
                 </tree>
             </field>
         </record>
             <field name="name">crm.case.stage.form</field>
             <field name="model">crm.case.stage</field>
             <field name="type">form</field>
+            <field name="priority" eval="1"/>
             <field name="arch" type="xml">
                 <form string="Stage">
                     <separator string="Stage Definition" colspan="4"/>
                 </form>
             </field>
         </record>
+        
+         <record model="ir.ui.view" id="crm_case_stage_form_full">
+            <field name="name">crm.case.stage.form</field>
+            <field name="model">crm.case.stage</field>
+            <field name="type">form</field>
+            <field name="priority" eval="10"/>
+            <field name="arch" type="xml">
+                <form string="Stage">
+                       <group col="6">
+                       <separator string="Stage Definition" colspan="6"/>
+                           <field name="name" select="1" colspan="4"/>
+                           <field name="sequence"/>
+                               <field name="type" />
+                                <field name="probability"/>
+                               <field name="on_change"/>
+                        </group>
+                     
+                    
+                   
+                    
+                    <separator string="Requirements" colspan="4"/>
+                    <field name="requirements" nolabel="1" colspan="4"/>
+                    
+                    <group attrs="{'invisible':[('type','in',['claim', 'fundraising', False])]}">
+                           <separator string="Sales Team" colspan="4"/>
+                           <field name="section_ids" nolabel="1"  />
+                       </group>
+                </form>
+            </field>
+        </record>
 
         <!-- CRM Stage Action -->
 
             <field name="view_type">form</field>
             <field name="view_id" ref="crm_case_stage_tree"/>
         </record>
+       
 
  <!-- Case Categories Form View -->
 
index cc6a1ac..c241b36 100644 (file)
@@ -135,4 +135,21 @@ class crm_claim(crm.crm_case, osv.osv):
 
 crm_claim()
 
+
+class crm_stage_claim(osv.osv):
+    
+    def _get_type_value(self, cr, user, context):
+        list = super(crm_stage_claim, self)._get_type_value(cr, user, context)
+        list.append(('claim','Claim'))
+        return list
+    
+    _inherit = "crm.case.stage"
+    _columns = {
+            'type': fields.selection(_get_type_value, 'Type'),
+    }
+   
+    
+crm_stage_claim()
+
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
index f495084..19ac21e 100644 (file)
@@ -94,3 +94,19 @@ class crm_fundraising(crm.crm_case, osv.osv):
             }
 
 crm_fundraising()
+
+
+class crm_stage_fundraising(osv.osv):
+    
+    def _get_type_value(self, cr, user, context):
+        list = super(crm_stage_fundraising, self)._get_type_value(cr, user, context)
+        list.append(('fundraising','Fundraising'))
+        return list
+    
+    _inherit = "crm.case.stage"
+    _columns = {
+            'type': fields.selection(_get_type_value, 'Type'),
+    }
+   
+    
+crm_stage_fundraising()