[ADD]: CRM Ergonomy Improvement blueprint: Added wizard on case history to send last mail

bzr revid: rpa@tinyerp.com-20091028085032-r41p2o4cw5lzvkqb
This commit is contained in:
rpa (Open ERP)
2009-10-28 14:20:32 +05:30
parent 487d6e924e
commit 6951e39fd2
5 changed files with 90 additions and 2 deletions
+1 -1
View File
@@ -47,9 +47,9 @@ between mails and Open ERP.""",
'depends': ['base'],
'init_xml': ['crm_data.xml'],
'update_xml': [
'crm_wizard.xml',
'crm_view.xml',
'crm_report.xml',
'crm_wizard.xml',
'security/crm_security.xml',
'security/ir.model.access.csv'
],
+5 -1
View File
@@ -380,10 +380,14 @@
</group>
<field name="history_line" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<group col="7" colspan="4">
<field name="date"/>
<field name="email"/>
<field name="canal_id"/>
<button
string="Add a CC"
name="%(wizard_crm_case_email_add_cc)d"
icon="gtk-add" type="action"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
+6
View File
@@ -10,5 +10,11 @@
<menuitem action="wizard_case_section_menu" id="menu_wizard_case_section_menu" parent="crm.menu_crm_configuration" type="wizard"/>
<wizard string="Add a CC"
model="crm.case"
menu = "False"
name="crm.case.email.add_cc"
id="wizard_crm_case_email_add_cc"/>
</data>
</openerp>
+1
View File
@@ -23,6 +23,7 @@ import crm_wizard
import wizard_crm_send_email
import wizard_crm_new_send_email
import wizard_fetch_mail
import wizard_add_cc
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+77
View File
@@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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/>.
#
##############################################################################
import time
import wizard
import osv
import pooler
cc_form = '''<?xml version="1.0"?>
<form string="Add a CC">
<field name="send_to"/>
<newline/>
<field name="user_id" attrs="{'readonly' : [('send_to','!=','user')], 'required' : [('send_to','=','user')]}"/>
<field name="partner_id" attrs="{'readonly' : [('send_to','!=','partner')], 'required' : [('send_to','=','partner')]}"/>/>
<field name="email"/>
</form>'''
#on_change="change_email(user_id, partner_id)"
cc_fields = {
'send_to' : {'string' : 'Send to', 'type' : 'selection', 'required' :True, \
'selection' :[('user','User'),('partner','Partner'),('email','Email Address')], \
'default' : 'email'},
'user_id' : {'string' : 'User', 'type' : 'many2one', 'relation' : 'res.users'},
'partner_id' : {'string' : 'Partner', 'type' : 'many2one', 'relation' : 'res.partner'},
'email' : {'string' : 'Email', 'type' : 'char', 'size' : 24},
}
#def change_email(self, cr, uid, data, context):
# return {}
def email_cc_add(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
history_line = pool.get('crm.case.history').browse(cr, uid, data['id'])
crm_case = pool.get('crm.case')
case_id = history_line.log_id.case_id.id
crm_case.write(cr, uid, case_id, {'email_cc' : data['form']['email']})
#TODO: send the latest email to the email adderss
return {}
class wizard_add_cc(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'form', 'arch' : cc_form, 'fields' :cc_fields,\
'state' :[('end','Cancel', 'gtk-cancel'),('add','Ok', 'gtk-go-forward' )]}
},
'add' : {
'actions' : [email_cc_add],
'result' : {'type' : 'state', 'state' : 'end'}
}
}
wizard_add_cc('crm.case.email.add_cc')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: