summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpa (Open ERP) <rpa@tinyerp.com>2010-03-18 16:22:45 +0530
committerrpa (Open ERP) <rpa@tinyerp.com>2010-03-18 16:22:45 +0530
commit1de1bbf6ec58a40fa6df93a0e10e8bec749b4bcf (patch)
tree2ccab8bdd765ee7ffcc59db5d5486a883d0ef03b
parente56f3c673c82ddc00c2d5b848aad5673c8654d76 (diff)
[IMP]: crm: Improvement in Phonecall to Meeting wizard, put proper docstring
bzr revid: rpa@tinyerp.com-20100318105245-8c5hojj4jru85ydb
-rw-r--r--addons/crm/__terp__.py8
-rw-r--r--addons/crm/wizard/__init__.py4
-rw-r--r--addons/crm/wizard/crm_opportunity_to_meeting_view.xml1
-rw-r--r--addons/crm/wizard/crm_phonecall_to_meeting.py99
-rw-r--r--addons/crm/wizard/crm_phonecall_to_meeting_view.xml (renamed from addons/crm/wizard/phonecall2meeting.xml)10
-rw-r--r--addons/crm/wizard/crm_phonecall_to_phonecall.py (renamed from addons/crm/wizard/crm_phonecall2phonecall.py)0
-rw-r--r--addons/crm/wizard/crm_phonecall_to_phonecall_view.xml (renamed from addons/crm/wizard/crm_phonecall2phonecall.xml)0
-rw-r--r--addons/crm/wizard/phonecall2meeting.py75
8 files changed, 114 insertions, 83 deletions
diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py
index 2ed47c61351..25a4c0839b2 100644
--- a/addons/crm/__terp__.py
+++ b/addons/crm/__terp__.py
@@ -63,12 +63,15 @@ between mails and Open ERP.""",
'update_xml': [
'wizard/crm_lead_to_partner_view.xml',
'wizard/crm_lead_to_opportunity_view.xml',
- 'wizard/crm_phonecall2phonecall.xml',
- 'wizard/phonecall2meeting.xml',
+
+ 'wizard/crm_phonecall_to_phonecall_view.xml',
+ 'wizard/crm_phonecall_to_meeting_view.xml',
'wizard/crm_phonecall_to_partner_view.xml',
'wizard/crm_phonecall_to_opportunity_view.xml',
+
'wizard/crm_opportunity_to_meeting_view.xml',
'wizard/crm_opportunity_to_phonecall_view.xml',
+
'crm_wizard.xml',
'crm_view.xml',
@@ -77,7 +80,6 @@ between mails and Open ERP.""",
'crm_lead_menu.xml',
'crm_meeting_view.xml',
'crm_meeting_menu.xml',
- #'crm_phonecall_wizard.xml',
'crm_phonecall_view.xml',
'crm_phonecall_menu.xml',
'crm_opportunity_view.xml',
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index 2d0a7eaf651..4ab5e00ad67 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -31,9 +31,9 @@ import crm_lead_to_opportunity
import crm_opportunity_to_meeting
import crm_opportunity_to_phonecall
-import crm_phonecall2phonecall
+import crm_phonecall_to_phonecall
import crm_phonecall_to_partner
-import phonecall2meeting
+import crm_phonecall_to_meeting
import crm_phonecall_to_opportunity
diff --git a/addons/crm/wizard/crm_opportunity_to_meeting_view.xml b/addons/crm/wizard/crm_opportunity_to_meeting_view.xml
index 99229aa738d..7ea05598d28 100644
--- a/addons/crm/wizard/crm_opportunity_to_meeting_view.xml
+++ b/addons/crm/wizard/crm_opportunity_to_meeting_view.xml
@@ -30,7 +30,6 @@
<field name="view_mode">form</field>
<field name="view_id" ref="opportunity2meeting_view"/>
<field name="target">new</field>
- <field name="context">{'record_id' : active_id}</field>
</record>
</data>
diff --git a/addons/crm/wizard/crm_phonecall_to_meeting.py b/addons/crm/wizard/crm_phonecall_to_meeting.py
new file mode 100644
index 00000000000..e3edcf894e0
--- /dev/null
+++ b/addons/crm/wizard/crm_phonecall_to_meeting.py
@@ -0,0 +1,99 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv
+from tools.translate import _
+
+class crm_phonecall2meeting(osv.osv_memory):
+ """ Phonecall to Meeting """
+
+ _name = 'crm.phonecall2meeting'
+ _description = 'Phonecall To Meeting'
+
+ def action_cancel(self, cr, uid, ids, context=None):
+ """
+ Closes Phonecall to Meeting form
+ @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 Phonecall to Meeting IDs
+ @param context: A standard dictionary for contextual values
+
+ """
+ return {'type':'ir.actions.act_window_close'}
+
+ def action_make_meeting(self, cr, uid, ids, context=None):
+ """
+ This opens Meeting's calendar view to schedule meeting on current Phonecall
+ @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 Phonecall to Meeting IDs
+ @param context: A standard dictionary for contextual values
+
+ @return : Dictionary value for created Meeting view
+ """
+ value = {}
+ record_id = context and context.get('active_id', False) or False
+
+ if record_id:
+ phonecall_obj = self.pool.get('crm.phonecall')
+ data_obj = self.pool.get('ir.model.data')
+
+ # Get meeting views
+ result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
+ res = 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_obj.browse(cr, uid, record_id, context=context)
+ context = {
+ 'default_phonecall_id': phonecall.id,
+ 'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False,
+ 'default_email': phonecall.email_from ,
+ 'default_name': phonecall.name
+ }
+
+ value = {
+ 'name': _('Meetings'),
+ 'domain' : "[('user_id','=',%s)]" % (uid),
+ 'context': context,
+ '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': res['res_id']
+ }
+
+ return value
+
+crm_phonecall2meeting()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/phonecall2meeting.xml b/addons/crm/wizard/crm_phonecall_to_meeting_view.xml
index fe90bbe5cd6..11561b81e8c 100644
--- a/addons/crm/wizard/phonecall2meeting.xml
+++ b/addons/crm/wizard/crm_phonecall_to_meeting_view.xml
@@ -1,6 +1,9 @@
<?xml version="1.0"?>
<openerp>
<data>
+
+ <!-- Phonecall to meeting view -->
+
<record model="ir.ui.view" id="phonecall2phonecall2meeting_view">
<field name="name">crm.phonecall2meeting.form</field>
<field name="model">crm.phonecall2meeting</field>
@@ -8,10 +11,13 @@
<field name="arch" type="xml">
<form string="Convert To Meeting ">
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
- <button name="action_makeMeeting" type="object" string="_Apply" icon="gtk-apply" />
+ <button name="action_make_meeting" type="object" string="_Convert" icon="gtk-convert" />
</form>
</field>
</record>
+
+ <!-- Phonecall to meeting action -->
+
<record model="ir.actions.act_window" id="phonecall2meeting_act">
<field name="name">Convert To Meeting</field>
<field name="res_model">crm.phonecall2meeting</field>
@@ -19,7 +25,7 @@
<field name="view_mode">form</field>
<field name="view_id" ref="phonecall2phonecall2meeting_view"/>
<field name="target">new</field>
- <field name="context">{'record_id' : active_id}</field>
</record>
+
</data>
</openerp> \ No newline at end of file
diff --git a/addons/crm/wizard/crm_phonecall2phonecall.py b/addons/crm/wizard/crm_phonecall_to_phonecall.py
index 60c05e3d6ed..60c05e3d6ed 100644
--- a/addons/crm/wizard/crm_phonecall2phonecall.py
+++ b/addons/crm/wizard/crm_phonecall_to_phonecall.py
diff --git a/addons/crm/wizard/crm_phonecall2phonecall.xml b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
index cdc673d0e65..cdc673d0e65 100644
--- a/addons/crm/wizard/crm_phonecall2phonecall.xml
+++ b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml
diff --git a/addons/crm/wizard/phonecall2meeting.py b/addons/crm/wizard/phonecall2meeting.py
deleted file mode 100644
index 89c0537aadd..00000000000
--- a/addons/crm/wizard/phonecall2meeting.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- encoding: utf-8 -*-
-############################################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
-# Copyright (C) 2008-2009 AJM Technologies S.A. (<http://www.ajm.lu). All Rights Reserved
-# $Id$
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-############################################################################################
-############################################################################################
-
-from osv import osv, fields
-import netsvc
-import time
-import tools
-import mx.DateTime
-from tools import config
-from tools.translate import _
-import tools
-
-class crm_phonecall2meeting(osv.osv_memory):
- _name = 'crm.phonecall2meeting'
- _description = 'Phonecall To Meeting'
-
- def action_cancel(self, cr, uid, ids, context=None):
- return {'type':'ir.actions.act_window_close'}
-
- def action_makeMeeting(self, cr, uid, ids, context=None):
- this = self.browse(cr, uid, ids[0], context=context)
- record_id = context and context.get('record_id', False) or False
- if record_id:
- phonecall_case_obj = self.pool.get('crm.phonecall')
- data_obj = self.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, record_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']
- }
-crm_phonecall2meeting() \ No newline at end of file