[ADD]: crm: Added old wizard for phonecall and opportunity to meeting because of...
authorrpa (Open ERP) <rpa@tinyerp.com>
Fri, 19 Mar 2010 12:52:50 +0000 (18:22 +0530)
committerrpa (Open ERP) <rpa@tinyerp.com>
Fri, 19 Mar 2010 12:52:50 +0000 (18:22 +0530)
bzr revid: rpa@tinyerp.com-20100319125250-6m68rs678puy31ta

addons/crm/crm_opportunity_view.xml
addons/crm/crm_phonecall_view.xml
addons/crm/wizard/crm_opportunity_to_meeting.py
addons/crm/wizard/crm_opportunity_to_meeting_view.xml
addons/crm/wizard/crm_phonecall_to_meeting.py
addons/crm/wizard/crm_phonecall_to_meeting_view.xml

index 9a6fb6f..17dc6ee 100644 (file)
@@ -64,7 +64,7 @@
                     </group>
                     <field name="user_id"/>
                     <button string="Schedule Meeting"
-                        name="%(opportunity2meeting_act)d" icon="gtk-redo" type="action" />
+                        name="%(wizard_crm_opportunity_meeting_set)d" icon="gtk-redo" type="action" />
                     <field name="planned_revenue"/>
                     <field name="probability"/>
                     <field name="date_deadline" string="Expected Closing"/>
index 1574b17..64be168 100644 (file)
@@ -54,7 +54,7 @@
                     type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}" />
                 <button string="Meeting"
                     states="draft,open,pending"
-                    name="%(phonecall2meeting_act)d"  type="action" />
+                    name="%(wizard_crm_phonecall_meeting_set)d"  type="action" />
                 <field name="state"/>
                 <button name="case_open" string="Open" 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"/>
@@ -75,7 +75,7 @@
                     <field name="date" string="Planned Date"/>
                     <field name="user_id"/>
                     <button string="Schedule a Meeting"
-                        name="%(phonecall2meeting_act)d"
+                        name="%(wizard_crm_phonecall_meeting_set)d"
                         icon="gtk-redo"
                         type="action" />
                     <field name="partner_phone"/>
index 2af7ddc..a2f94a5 100644 (file)
 
 from osv import osv
 from tools.translate import _
+import wizard
+import pooler
+
+#===============================================================================
+# Put original wizard because of action in init
+# Remove it after solution foraction in init
+#===============================================================================
+
+class opportunity2meeting(wizard.interface):
+
+    def _makeMeeting(self, cr, uid, data, context):
+        pool = pooler.get_pool(cr.dbname)
+        opportunity_case_obj = pool.get('crm.opportunity')                
+        data_obj = pool.get('ir.model.data')
+        result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
+        id = data_obj.read(cr, uid, result, ['res_id'])
+        id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
+        id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
+        id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
+        if id1:
+            id1 = data_obj.browse(cr, uid, id1, context=context).res_id
+        if id2:
+            id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+        if id3:
+            id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+        opportunity = opportunity_case_obj.browse(cr, uid, data['id'], context=context)
+        partner_id = opportunity.partner_id and opportunity.partner_id.id or False
+        name = opportunity.name
+        email = opportunity.email_from
+        section_id = opportunity.section_id and opportunity.section_id.id or False
+        return {            
+            'name': _('Meetings'),
+            'domain' : "[('user_id','=',%s), ('opportunity_id', '=', %s)]"%(uid, data['id']),  
+            'context': {'default_partner_id': partner_id, 
+                        'default_opportunity_id': data['id'], 
+                        'default_section_id': section_id, 
+                        'default_email_from': email, 
+                        'default_state':'open', 'default_name':name},
+            'view_type': 'form',
+            'view_mode': 'tree,form,calendar',
+            'res_model': 'crm.meeting',
+            'view_id': False,
+            'views': [(id1, 'calendar'), (id3, 'tree'), (id2, 'form')], 
+            'type': 'ir.actions.act_window',
+            'search_view_id': id['res_id']
+            }
+
+    states = {
+        'init': {
+            'actions': [],
+            'result': {'type': 'action', 'action': _makeMeeting, 'state': 'order'}
+        },
+        'order': {
+            'actions': [],
+            'result': {'type': 'state', 'state': 'end'}
+        }
+    }
+opportunity2meeting('crm.opportunity.meeting_set')
 
 class crm_opportunity2meeting(osv.osv_memory):
     _name = 'crm.opportunity2meeting'
index 7ea0559..9fdf506 100644 (file)
@@ -1,6 +1,16 @@
 <?xml version="1.0"?>
 <openerp>
     <data>
+    
+<!--  Old wizard -->
+
+       <wizard
+            id="wizard_crm_opportunity_meeting_set"
+            keyword="client_action_multi"
+            model="crm.opportunity"
+                       name="crm.opportunity.meeting_set"
+                       menu="False"
+            string="Schedule Meeting"/>        
 
            <!-- Opportunity to meeting view -->
 
index e3edcf8..bf63c31 100644 (file)
 
 from osv import osv
 from tools.translate import _
+import wizard
+import pooler
+
+#===============================================================================
+# Put original wizard because of action in init
+# Remove it after solution foraction in init
+#===============================================================================
+
+class phonecall2meeting(wizard.interface):
+
+    def _makeMeeting(self, cr, uid, data, context):
+        pool = pooler.get_pool(cr.dbname)
+        phonecall_case_obj = pool.get('crm.phonecall')                   
+        data_obj = pool.get('ir.model.data')
+        result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
+        id = data_obj.read(cr, uid, result, ['res_id'])
+        id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
+        id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
+        id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
+        if id1:
+            id1 = data_obj.browse(cr, uid, id1, context=context).res_id
+        if id2:
+            id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+        if id3:
+            id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+        phonecall = phonecall_case_obj.browse(cr, uid, data['id'], context=context)
+        partner_id = phonecall.partner_id and phonecall.partner_id.id or False
+        name = phonecall.name
+        email = phonecall.email_from
+        section_id = phonecall.section_id and phonecall.section_id.id or False      
+        return {            
+            'name': _('Meetings'),
+            'domain' : "[('user_id','=',%s)]"%(uid), 
+            'context': {'default_partner_id': partner_id, 'default_section_id': section_id, 'default_email_from': email, 'default_state':'open', 'default_name':name},        
+            'view_type': 'form',
+            'view_mode': 'calendar,form,tree',
+            'res_model': 'crm.meeting',
+            'view_id': False,
+            'views': [(id1,'calendar'),(id2,'form'),(id3,'tree')],
+            'type': 'ir.actions.act_window',
+            'search_view_id': id['res_id']
+            }
+
+    states = {
+        'init': {
+            'actions': [],
+            'result': {'type': 'action', 'action': _makeMeeting, 'state': 'order'}
+        },
+        'order': {
+            'actions': [],
+            'result': {'type': 'state', 'state': 'end'}
+        }
+    }
+phonecall2meeting('crm.phonecall.meeting_set')
 
 class crm_phonecall2meeting(osv.osv_memory):
     """ Phonecall to Meeting """
index 0e889c7..ef2fe19 100644 (file)
@@ -2,6 +2,16 @@
 <openerp>
     <data>
 
+<!--  Old wizard -->
+
+       <wizard
+            id="wizard_crm_phonecall_meeting_set"
+            keyword="client_action_multi"
+            model="crm.phonecall"
+            name="crm.phonecall.meeting_set"
+            multi="True"
+            string="Schedule Meeting"/>
+            
            <!-- Phonecall to meeting view -->
 
         <record model="ir.ui.view" id="phonecall2phonecall2meeting_view">