[IMP]: crm: Improvement in Opportunity schedule meeting wizard + Quality improvement

bzr revid: rpa@tinyerp.com-20100316114531-ff8405ri69ciesvb
This commit is contained in:
rpa (Open ERP)
2010-03-16 17:15:31 +05:30
parent 96929a5705
commit eba05bd705
5 changed files with 118 additions and 83 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ between mails and Open ERP.""",
'wizard/phonecall2partner_view.xml',
'wizard/phonecall2opportunity.xml',
'wizard/opportunity2partner_view.xml',
'wizard/opportunity2meeting.xml',
'wizard/crm_opportunity_to_meeting_view.xml',
'wizard/opportunity2phonecall.xml',
'crm_wizard.xml',
'crm_view.xml',
+4 -2
View File
@@ -19,7 +19,6 @@
#
##############################################################################
import crm_opportunity_wizard
import crm_phonecall_wizard
import wizard_crm_send_email
@@ -29,12 +28,15 @@ import wizard_history_event
import crm_lead_to_partner
import crm_lead_to_opportunity
import crm_opportunity_to_meeting
import crm_phonecall2phonecall
import phonecall2partner
import phonecall2meeting
import phonecall_to_opportunity
import opportunity2partner
import opportunity2meeting
import opportunity2phonecall
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,98 @@
# -*- 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_opportunity2meeting(osv.osv_memory):
_name = 'crm.opportunity2meeting'
_description = 'Opportunity To Meeting'
def action_cancel(self, cr, uid, ids, context=None):
"""
Closes Opportunity 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 Opportunity to Meeting IDs
@param context: A standard dictionary for contextual values
"""
return {'type': 'ir.actions.act_window_close'}
def action_makeMeeting(self, cr, uid, ids, context=None):
"""
This opens Meeting's calendar view to schedule meeting on current Opportunity
@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 Opportunity to Meeting IDs
@param context: A standard dictionary for contextual values
@return : Dictionary value for created Meeting view
"""
value = {}
record_ids = context and context.get('active_ids', []) or []
if record_ids:
opp_obj = self.pool.get('crm.opportunity')
data_obj = self.pool.get('ir.model.data')
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
for this in self.browse(cr, uid, ids, context=context):
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
context = {
'default_opportunity_id': opp.id,
'default_partner_id': opp.partner_id and opp.partner_id.id or False,
'default_section_id': opp.section_id and opp.section_id.id or False,
'default_email_from': opp.email_from,
'default_state': 'open',
'default_name': opp.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_opportunity2meeting()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,17 +1,28 @@
<?xml version="1.0"?>
<openerp>
<data>
<!-- Opportunity to meeting view -->
<record model="ir.ui.view" id="opportunity2meeting_view">
<field name="name">crm.opportunity2meeting.form</field>
<field name="model">crm.opportunity2meeting</field>
<field name="type">form</field>
<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" />
<form string="Convert To Meeting">
<label string="Are you sure to schedule a meeting for this Opportunity?" colspan="4"/>
<newline/>
<separator colspan="4" string=""/>
<button name="action_cancel" string="_Cancel"
icon="gtk-cancel" special="cancel" />
<button name="action_makeMeeting" type="object"
string="_Schedule" icon="gtk-go-forward" />
</form>
</field>
</record>
<!-- Opportunity to meeting action -->
<record model="ir.actions.act_window" id="opportunity2meeting_act">
<field name="name">Convert To Meeting</field>
<field name="res_model">crm.opportunity2meeting</field>
@@ -21,5 +32,6 @@
<field name="target">new</field>
<field name="context">{'record_id' : active_id}</field>
</record>
</data>
</openerp>
-77
View File
@@ -1,77 +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_opportunity2meeting(osv.osv_memory):
_name = 'crm.opportunity2meeting'
_description = 'Opportunity 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:
opportunity_case_obj = self.pool.get('crm.opportunity')
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
opportunity = opportunity_case_obj.browse(cr, uid, record_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)]"%(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']
}
else:
return {}
crm_opportunity2meeting()