[IMP]: crm: Apply some changes and add function

bzr revid: ksa@tinyerp.co.in-20100401113130-48zf5bsafdt1x3p6
This commit is contained in:
ksa (Open ERP) 2010-04-01 17:01:30 +05:30
parent 51e47526d3
commit 80a2d0463f
10 changed files with 172 additions and 275 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -31,7 +31,6 @@ import crm_claim
import crm_fundraising
import crm_helpdesk
import report
import wizard

View File

@ -41,84 +41,82 @@ appropriate staff, and making sure all future correspondence gets to the right
place.
The CRM module has a email gateway for the synchronisation interface
between mails and Open ERP.""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['base', 'base_action_rule',
'process',
'mail_gateway',
between mails and Open ERP.""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['base', 'base_action_rule',
'process',
'mail_gateway',
'base_calendar',
],
'init_xml': ['crm_data.xml',
'crm_meeting_data.xml',
'crm_claims_data.xml',
'crm_fund_data.xml',
'crm_helpdesk_data.xml',
'crm_lead_data.xml',
'crm_meeting_data.xml',
'crm_opportunity_data.xml',
'crm_phonecall_data.xml',
],
],
'init_xml': ['crm_data.xml',
'crm_meeting_data.xml',
'crm_claims_data.xml',
'crm_fund_data.xml',
'crm_helpdesk_data.xml',
'crm_lead_data.xml',
'crm_meeting_data.xml',
'crm_opportunity_data.xml',
'crm_phonecall_data.xml',
],
'update_xml': [
'wizard/crm_lead_to_partner_view.xml',
'wizard/crm_lead_to_opportunity_view.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',
'wizard/crm_partner_to_opportunity_view.xml',
'wizard/crm_send_email_view.xml',
'wizard/crm_email_add_cc_view.xml',
'crm_wizard.xml',
'wizard/crm_send_email_view.xml',
'wizard/crm_email_add_cc_view.xml',
'crm_wizard.xml',
'crm_view.xml',
'crm_action_rule_view.xml',
'crm_lead_view.xml',
'crm_lead_menu.xml',
'crm_meeting_view.xml',
'crm_meeting_menu.xml',
'crm_phonecall_view.xml',
'crm_phonecall_menu.xml',
'crm_opportunity_view.xml',
'crm_opportunity_menu.xml',
'crm_fund_view.xml',
'crm_fund_menu.xml',
'crm_claims_view.xml',
'crm_claims_menu.xml',
'crm_action_rule_view.xml',
'crm_lead_view.xml',
'crm_lead_menu.xml',
'crm_meeting_view.xml',
'crm_meeting_menu.xml',
'crm_phonecall_view.xml',
'crm_phonecall_menu.xml',
'crm_opportunity_view.xml',
'crm_opportunity_menu.xml',
'crm_fund_view.xml',
'crm_fund_menu.xml',
'crm_claims_view.xml',
'crm_claims_menu.xml',
'crm_helpdesk_view.xml',
'crm_helpdesk_menu.xml',
'security/crm_security.xml',
'security/ir.model.access.csv',
'crm_helpdesk_menu.xml',
'security/crm_security.xml',
'security/ir.model.access.csv',
'report/crm_report_view.xml',
'report/crm_claim_report_view.xml',
'report/crm_lead_report_view.xml',
'report/crm_fundraising_report_view.xml',
'report/crm_opportunity_report_view.xml' ,
'report/crm_opportunity_report_view.xml' ,
'report/crm_phonecall_report_view.xml',
'process/crm_configuration_process.xml',
],
'demo_xml': [
'crm_demo.xml',
'crm_claims_demo.xml',
'crm_fund_demo.xml',
'crm_helpdesk_demo.xml',
'crm_lead_demo.xml',
'crm_meeting_demo.xml',
'crm_opportunity_demo.xml',
'crm_phonecall_demo.xml'],
'installable': True,
'active': False,
'certificate': '0079056041421',
'crm_demo.xml',
'crm_claims_demo.xml',
'crm_fund_demo.xml',
'crm_helpdesk_demo.xml',
'crm_lead_demo.xml',
'crm_meeting_demo.xml',
'crm_opportunity_demo.xml',
'crm_phonecall_demo.xml'],
'installable': True,
'active': False,
'certificate': '0079056041421',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,6 +21,7 @@
from datetime import datetime
from osv import fields,osv,orm
from tools.translate import _
import crm
AVAILABLE_STATES = [
@ -166,5 +167,57 @@ class crm_opportunity(osv.osv):
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
}
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 users 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 = {}
for opp in self.browse(cr, uid, ids):
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
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'],
'nodestroy': True
}
return value
crm_opportunity()

View File

@ -71,8 +71,10 @@
type="object" icon="gtk-go-forward" string="" />
</group>
<field name="user_id"/>
<button string="Schedule Meeting"
name="%(wizard_crm_opportunity_meeting_set)d" icon="gtk-redo" type="action" />
<button name="action_makeMeeting" type="object"
string="Schedule Meeting" icon="gtk-redo" />
<field name="planned_revenue"/>
<field name="probability"/>
<field name="date_deadline" string="Expected Closing"/>
@ -151,7 +153,7 @@
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
<field name="user_id"/>
</form>
</field>
</page>

View File

@ -20,6 +20,7 @@
##############################################################################
from osv import fields, osv
from tools.translate import _
import crm
import time
@ -48,7 +49,7 @@ class crm_phonecall(osv.osv):
the canall which is this opportunity source."),
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'opportunity_id':fields.many2one ('crm.opportunity', 'Opportunity'),
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
}
_defaults = {
@ -56,6 +57,57 @@ class crm_phonecall(osv.osv):
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
}
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 users 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 = {}
for phonecall in self.browse(cr, uid, ids):
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
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'],
'nodestroy': True
}
return value
crm_phonecall()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -53,7 +53,7 @@
type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<button string="Meeting"
states="draft,open,pending"
name="%(wizard_crm_phonecall_meeting_set)d" type="action" />
name="action_make_meeting" 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"/>
@ -76,9 +76,10 @@
<field name="date" string="Planned Date"/>
<field name="user_id"/>
<button string="Schedule a Meeting"
name="%(wizard_crm_phonecall_meeting_set)d"
name="action_make_meeting"
icon="gtk-redo"
type="action" />
type="object" />
<field name="partner_phone"/>
<field name="duration"/>
<field name="section_id" colspan="1" widget="selection" />

View File

@ -34,11 +34,9 @@
"access_report_crm_case_service_dashboard","report.crm.case.service.dashboard","model_report_crm_case_service_dashboard","crm.group_crm_user",1,0,0,0
"access_crm_lead2partner","crm.lead2partner","model_crm_lead2partner","crm.group_crm_user",1,1,1,1
"access_crm_lead2opportunity","crm.lead2opportunity","model_crm_lead2opportunity","crm.group_crm_user",1,1,1,1
"access_crm_opportunity2meeting","crm.opportunity2meeting","model_crm_opportunity2meeting","crm.group_crm_user",1,1,1,1
"access_crm_opportunity2phonecall","crm.opportunity2phonecall","model_crm_opportunity2phonecall","crm.group_crm_user",1,1,1,1
"access_crm_phonecall2phonecall","crm.phonecall2phonecall","model_crm_phonecall2phonecall","crm.group_crm_user",1,1,1,1
"access_crm_phonecall2partner","crm.phonecall2partner","model_crm_phonecall2partner","crm.group_crm_user",1,1,1,1
"access_crm_phonecall2meeting","crm.phonecall2meeting","model_crm_phonecall2meeting","crm.group_crm_user",1,1,1,1
"access_crm_phonecall2opportunity","crm.phonecall2opportunity","model_crm_phonecall2opportunity","crm.group_crm_user",1,1,1,1
"access_report_crm_helpdesk","report.crm.helpdesk","model_crm_helpdesk_report","crm.group_crm_user",1,1,1,1
"access_crm_send_mail","crm.send.mail","model_crm_send_mail","crm.group_crm_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
34 access_report_crm_case_service_dashboard report.crm.case.service.dashboard model_report_crm_case_service_dashboard crm.group_crm_user 1 0 0 0
35 access_crm_lead2partner crm.lead2partner model_crm_lead2partner crm.group_crm_user 1 1 1 1
36 access_crm_lead2opportunity crm.lead2opportunity model_crm_lead2opportunity crm.group_crm_user 1 1 1 1
access_crm_opportunity2meeting crm.opportunity2meeting model_crm_opportunity2meeting crm.group_crm_user 1 1 1 1
37 access_crm_opportunity2phonecall crm.opportunity2phonecall model_crm_opportunity2phonecall crm.group_crm_user 1 1 1 1
38 access_crm_phonecall2phonecall crm.phonecall2phonecall model_crm_phonecall2phonecall crm.group_crm_user 1 1 1 1
39 access_crm_phonecall2partner crm.phonecall2partner model_crm_phonecall2partner crm.group_crm_user 1 1 1 1
access_crm_phonecall2meeting crm.phonecall2meeting model_crm_phonecall2meeting crm.group_crm_user 1 1 1 1
40 access_crm_phonecall2opportunity crm.phonecall2opportunity model_crm_phonecall2opportunity crm.group_crm_user 1 1 1 1
41 access_report_crm_helpdesk report.crm.helpdesk model_crm_helpdesk_report crm.group_crm_user 1 1 1 1
42 access_crm_send_mail crm.send.mail model_crm_send_mail crm.group_crm_user 1 1 1 1

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -24,13 +24,9 @@ import crm_email_add_cc
import crm_lead_to_partner
import crm_lead_to_opportunity
import crm_opportunity_to_meeting
import crm_opportunity_to_phonecall
import crm_phonecall_to_phonecall
import crm_phonecall_to_partner
import crm_phonecall_to_meeting
import crm_phonecall_to_opportunity
import crm_partner_to_opportunity

View File

@ -1,156 +0,0 @@
# -*- 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 _
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'
_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 users 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 users 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_id = context and context.get('active_id', False) or False
if record_id:
opp_obj = self.pool.get('crm.opportunity')
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
opp = opp_obj.browse(cr, uid, record_id, 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:

View File

@ -1,46 +0,0 @@
<?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 -->
<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">
<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>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="opportunity2meeting_view"/>
<field name="target">new</field>
</record>
</data>
</openerp>