[REM]: Removed Add CC wizard from crm and changes in crm + other modules for it

bzr revid: rpa@tinyerp.com-20100512071217-kbud9xl01sk9q6dh
This commit is contained in:
rpa (Open ERP) 2010-05-12 12:42:17 +05:30
parent 09e68a78e5
commit ceda4d163e
13 changed files with 28 additions and 219 deletions

View File

@ -74,7 +74,6 @@ between mails and Open ERP.""",
'wizard/crm_forward_to_partner_view.xml',
'wizard/crm_send_email_view.xml',
'wizard/crm_email_add_cc_view.xml',
'crm_view.xml',
'crm_action_rule_view.xml',

View File

@ -155,14 +155,10 @@
<!-- TODO-->
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>

View File

@ -172,15 +172,11 @@
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"

View File

@ -395,17 +395,12 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<!-- TODO-->
<!-- <field name="history_line" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
@ -420,7 +415,7 @@
<field name="email_to"/>
<field name="date"/>
</tree>
</field> -->
</field>
<button colspan="4" string="Send New Email"
name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.case'}"

View File

@ -12,8 +12,6 @@
"access_crm_case_categ_manager","crm.case.categ.manager","model_crm_case_categ","crm.group_crm_manager",1,1,1,1
"access_crm_case_log_manager","crm.case.log manager","model_crm_case_log","crm.group_crm_manager",1,1,1,1
"access_crm_case_history_manager","crm.case.history manager","model_crm_case_history","crm.group_crm_manager",1,1,1,1
"access_crm_email_add_cc_manager","crm.email.add.cc","model_crm_email_add_cc","crm.group_crm_manager",1,1,1,1
"access_crm_email_add_cc_user","crm.email.add.cc","model_crm_email_add_cc","crm.group_crm_user",1,0,0,0
"access_crm_case_stage","crm.case.stage","model_crm_case_stage","crm.group_crm_user",1,0,0,0
"access_crm_case_stage_manager","crm.case.stage","model_crm_case_stage","crm.group_crm_manager",1,1,1,1
"access_crm_case_resource_type_user","crm_case_resource_type user","model_crm_case_resource_type","crm.group_crm_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
12 access_crm_case_categ_manager crm.case.categ.manager model_crm_case_categ crm.group_crm_manager 1 1 1 1
13 access_crm_case_log_manager crm.case.log manager model_crm_case_log crm.group_crm_manager 1 1 1 1
14 access_crm_case_history_manager crm.case.history manager model_crm_case_history crm.group_crm_manager 1 1 1 1
access_crm_email_add_cc_manager crm.email.add.cc model_crm_email_add_cc crm.group_crm_manager 1 1 1 1
access_crm_email_add_cc_user crm.email.add.cc model_crm_email_add_cc crm.group_crm_user 1 0 0 0
15 access_crm_case_stage crm.case.stage model_crm_case_stage crm.group_crm_user 1 0 0 0
16 access_crm_case_stage_manager crm.case.stage model_crm_case_stage crm.group_crm_manager 1 1 1 1
17 access_crm_case_resource_type_user crm_case_resource_type user model_crm_case_resource_type crm.group_crm_user 1 0 0 0

View File

@ -21,7 +21,6 @@
import crm_send_email
import crm_forward_to_partner
import crm_email_add_cc
import crm_lead_to_partner
import crm_lead_to_opportunity

View File

@ -1,109 +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, fields
from tools.translate import _
import tools
class crm_email_add_cc_wizard(osv.osv_memory):
""" Email Add CC"""
_name = "crm.email.add.cc"
_description = "Email Add CC"
_columns = {
'name': fields.selection([('user', 'User'), ('partner', 'Partner'), \
('email', 'Email Address')], 'Send to', required=True),
'user_id': fields.many2one('res.users', "User"),
'partner_id': fields.many2one('res.partner', "Partner"),
'email': fields.char('Email', size=32),
'subject': fields.char('Subject', size=32),
}
def on_change_email(self, cr, uid, ids, user, partner):
""" @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 Mails IDs
"""
if (not partner and not user):
return {'value': {'email': False}}
email = False
if partner:
addr = self.pool.get('res.partner').address_get(cr, uid, [partner], ['contact'])
if addr and addr['contact']:
email = self.pool.get('res.partner.address').read(cr, uid, addr['contact'] , ['email'])['email']
elif user:
addr = self.pool.get('res.users').read(cr, uid, user, ['address_id'])['address_id']
if addr:
email = self.pool.get('res.partner.address').read(cr, uid, addr[0] , ['email'])['email']
return {'value': {'email': email}}
def add_cc(self, cr, uid, ids, context={}):
"""
Adds CC value in case
@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 create menus IDs
@param context: A standard dictionary for contextual values
"""
data = self.read(cr, uid, ids[0])
email = data['email']
subject = data['subject']
if not context:
return {}
history_line = self.pool.get('crm.case.history').browse(cr, uid, context['active_id'])
model = history_line.log_id.model_id.model
model_pool = self.pool.get(model)
case = model_pool.browse(cr, uid, history_line.log_id.res_id)
body = history_line.description.replace('\n', '\n> ')
if not case.email_from:
raise osv.except_osv(_('Warning!'), ('No email Address defined for this case..'))
if not email:
raise osv.except_osv(_('Warning!'), ('Please Specify email address..'))
flag = tools.email_send(
case.user_id.address_id.email,
[case.email_from],
subject or '[' + str(case.id) + '] ' + case.name,
model_pool.format_body(body),
email_cc = [email],
openobject_id = str(case.id),
subtype = "html"
)
if flag:
model_pool.write(cr, uid, case.id, {'email_cc' : case.email_cc and case.email_cc + ',' + email or email})
else:
raise osv.except_osv(_('Email Fail!'), ("Lastest Email is not sent successfully"))
return {}
def action_cancel(self, cr, uid, ids, context=None):
return {'type' : 'ir.actions.act_window_close'}
crm_email_add_cc_wizard()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,50 +0,0 @@
<openerp>
<data>
<!-- CRM Email Add CC Form View -->
<record id="view_crm_email_add_cc_wizard" model="ir.ui.view">
<field name="name">Add CC</field>
<field name="model">crm.email.add.cc</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Send mail to CC">
<separator colspan="4" string="Send mail to CC" />
<field name="name" width="200" />
<field name="subject" colspan="4" />
<separator colspan="4" string="" />
<group col="2" colspan="2" attrs="{ 'invisible' : [('name','!=','user')]}">
<field name="user_id"
attrs="{ 'required' : [('name','=','user')]}"
on_change="on_change_email(user_id, partner_id)" />
</group>
<newline />
<group col="2" colspan="2"
attrs="{ 'invisible' : [('name','!=','partner')]}">
<field name="partner_id"
attrs="{'required' : [('name','=','partner')]}"
on_change="on_change_email(user_id, partner_id)" />
</group>
<field colspan="4" name="email" attrs="{ 'required' : [('name','=','email')]}" />
<separator colspan="4" string="" />
<group col="2" colspan="4">
<button name="action_cancel" special="cancel" string="Cancel" icon="gtk-cancel" type="object" />
<button name="add_cc" string="_Forward" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<!-- CRM Email Add CC Action -->
<record id="action_view_crm_email_add_cc_wizard" model="ir.actions.act_window">
<field name="name">Add CC</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.email.add.cc</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -176,15 +176,11 @@
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"

View File

@ -189,15 +189,11 @@
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"

View File

@ -120,15 +120,11 @@
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"

View File

@ -148,15 +148,11 @@
</group>
<field name="history_line" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"

View File

@ -89,28 +89,29 @@
<field name="active"/>
</group>
<field name="log_ids" nolabel="1" colspan="4">
<form string="Actions">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date" />
<field name="user_id" />
</form>
</field>
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="history_line" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="7" colspan="4">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<button
string="Add a CC"
name="%(crm.action_view_crm_email_add_cc_wizard)d"
icon="gtk-add" type="action"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>