[Add] crm: add the osv_memory wizard of opportunity2meeting
bzr revid: sbh@tinyerp.com-20100309122938-x9a2c1hpnj7llqz3
This commit is contained in:
parent
d99f306b54
commit
42c1d6d634
|
@ -67,6 +67,7 @@ between mails and Open ERP.""",
|
|||
'wizard/phonecall2partner_view.xml',
|
||||
'wizard/phonecall2opportunity.xml',
|
||||
'wizard/opportunity2partner_view.xml',
|
||||
'wizard/opportunity2meeting.xml',
|
||||
'crm_wizard.xml',
|
||||
'crm_view.xml',
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
</group>
|
||||
<field name="user_id"/>
|
||||
<button string="Schedule Meeting"
|
||||
name="%(wizard_crm_opportunity_meeting_set)d" icon="gtk-redo" type="action" />
|
||||
name="%(opportunity2meeting_act)d" icon="gtk-redo" type="action" />
|
||||
<field name="planned_revenue"/>
|
||||
<field name="probability"/>
|
||||
<field name="date_deadline" string="Expected Closing"/>
|
||||
|
|
|
@ -33,6 +33,7 @@ import phonecall2partner
|
|||
import phonecall2meeting
|
||||
import phonecall_to_opportunity
|
||||
import opportunity2partner
|
||||
import opportunity2meeting
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
# -*- 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 _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()
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<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="_makeMeeting" type="object" string="_Apply" icon="gtk-apply" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="opportunity2meeting_act">
|
||||
<field name="name">Convert To Meeting</field>
|
||||
<field name="res_model">crm.opportunity2meeting</field>
|
||||
<field name="view_type">form</field>
|
||||
<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>
|
||||
</openerp>
|
|
@ -19,7 +19,7 @@
|
|||
<field name="name">Create a Partner</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">crm.opportunity2partner</field>
|
||||
<field name="view_id" ref="view_crm_lead2partner_create"/>
|
||||
<field name="view_id" ref="view_crm_opportunity2partner_create"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
|
|
Loading…
Reference in New Issue