@@ -83,7 +83,7 @@ Create dashboard for CRM that includes:
|
||||
'wizard/crm_opportunity_to_phonecall_view.xml',
|
||||
'wizard/crm_partner_to_opportunity_view.xml',
|
||||
|
||||
'wizard/crm_send_email_view.xml',
|
||||
# 'wizard/crm_send_email_view.xml',
|
||||
'wizard/crm_add_note_view.xml',
|
||||
'wizard/crm_merge_opportunities_view.xml',
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
<field name="context">{'type':'lead'}</field>
|
||||
<field name="help">Add specific stages to leads and opportunities allowing your sales to better organise their sales pipeline. Stages will allow them to easily track how a specific lead or opportunity is positioned in the sales cycle.</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<menuitem action="crm_lead_stage_act" id="menu_crm_lead_stage_act" name="Stages"
|
||||
groups="base.group_extended" sequence="0"
|
||||
@@ -170,8 +170,8 @@
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="Communication history">
|
||||
@@ -187,11 +187,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -208,9 +207,9 @@
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="crm_opportunity_stage_act" model="ir.actions.act_window">
|
||||
<field name="name">Stages</field>
|
||||
<field name="res_model">crm.case.stage</field>
|
||||
@@ -11,13 +11,13 @@
|
||||
<field name="context">{'type':'opportunity'}</field>
|
||||
<field name="help">Create specific stages that will help your sales better organise their sales pipeline by maintaining them to their sales opportunities. It will allow them to easily track how is positioned a specific opportunity in the sales cycle.</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
<menuitem action="crm_opportunity_stage_act" id="menu_crm_opportunity_stage_act" name="Stages"
|
||||
groups="base.group_extended" sequence="0"
|
||||
parent="base.menu_crm_config_opportunity" />
|
||||
|
||||
|
||||
<!-- Opportunities Form View -->
|
||||
<record model="ir.ui.view" id="crm_case_form_view_oppor">
|
||||
<field name="name">Opportunities</field>
|
||||
@@ -154,11 +154,10 @@
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</tree>
|
||||
<form string="History">
|
||||
<group col="4" colspan="4">
|
||||
@@ -173,11 +172,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -193,10 +191,10 @@
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group col="2" colspan="2">
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_send_email
|
||||
#import crm_send_email
|
||||
import email_compose_message
|
||||
import crm_add_note
|
||||
|
||||
import crm_lead_to_partner
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# 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
|
||||
from osv import fields
|
||||
import tools
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
model = ['crm.lead', 'crm.claim', 'crm.fundraising', 'crm.helpdesk', 'event.registration', 'hr.applicant', 'project.issue']
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
if context.get('active_id',False) and context.get('active_model',False) and context.get('active_model') in model:
|
||||
model_obj = self.pool.get(context.get('active_model'))
|
||||
data = model_obj.browse(cr, uid ,context.get('active_id'), context)
|
||||
if 'name' in fields:
|
||||
result['name'] = data.name
|
||||
|
||||
if 'email_to' in fields:
|
||||
result['email_to'] = data.email_from
|
||||
|
||||
if 'email_from' in fields:
|
||||
result['email_from'] = data.user_id and data.user_id.address_id and data.user_id.address_id.email
|
||||
|
||||
if 'description' in fields:
|
||||
result['description'] = '\n' + (tools.ustr(data.user_id.signature or ''))
|
||||
|
||||
if 'model' in fields:
|
||||
result['model'] = context.get('active_model','')
|
||||
|
||||
if 'email_cc' in fields:
|
||||
result['email_cc'] = tools.ustr(data.email_cc or '')
|
||||
|
||||
if 'res_id' in fields:
|
||||
result['res_id'] = context.get('active_id',0)
|
||||
|
||||
if 'reply_to' in fields and hasattr(data, 'section_id'):
|
||||
result['reply_to'] = data.section_id and data.section_id.reply_to or False
|
||||
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -33,7 +33,7 @@
|
||||
<field name="context">{'type':'claim'}</field>
|
||||
<field name="help">You can create claim stages to categorize the status of every claim entered in the system. The stages define all the steps required for the resolution of a claim.</field>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem action="crm_claim_stage_act" name="Stages"
|
||||
id="menu_crm_claim_stage_act" parent="menu_config_claim" />
|
||||
|
||||
@@ -75,15 +75,10 @@
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="date"/>
|
||||
|
||||
|
||||
</group>
|
||||
|
||||
<group colspan="4" col="6">
|
||||
|
||||
<field name="user_id"/>
|
||||
<field name="section_id" widget="selection" />
|
||||
|
||||
<group colspan="2" col="4">
|
||||
<field name="stage_id" domain="[('type','=','claim')]"/>
|
||||
<button name="stage_previous" string="" type="object" icon="gtk-go-back" />
|
||||
@@ -164,11 +159,11 @@
|
||||
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<button
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" attrs="{'invisible': [('history', '!=', True)]}" />
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="Communication & History">
|
||||
<group col="4" colspan="4">
|
||||
@@ -183,11 +178,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -203,10 +197,10 @@
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.claim'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</group>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<field name="context">{'type':'fundraising'}</field>
|
||||
<field name="help">Create and manage fund raising activity categories you want to be maintained in the system.</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
<menuitem action="crm_fundraising_stage_act"
|
||||
@@ -148,11 +148,11 @@
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
<group col="4" colspan="4">
|
||||
@@ -167,11 +167,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -187,10 +186,10 @@
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.fundraising'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group col="2" colspan="2">
|
||||
|
||||
@@ -100,11 +100,11 @@
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
<group col="4" colspan="4">
|
||||
@@ -119,11 +119,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -139,10 +138,10 @@
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.helpdesk'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group colspan="2" col="2">
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
'wizard/email_template_preview_view.xml',
|
||||
'email_template_view.xml',
|
||||
'wizard/email_template_send_wizard_view.xml',
|
||||
'wizard/email_compose_message_view.xml',
|
||||
'security/ir.model.access.csv'
|
||||
],
|
||||
"installable": True,
|
||||
|
||||
@@ -168,6 +168,7 @@ This is useful for CRM leads for example"),
|
||||
" body for displaying the info in your mail.",
|
||||
store=False),
|
||||
'auto_delete': fields.boolean('Auto Delete', help="Permanently delete emails after sending"),
|
||||
'model': fields.related('model_id','model', type='char', size=128, string='Object'),
|
||||
}
|
||||
|
||||
_sql_constraints = [
|
||||
@@ -371,8 +372,11 @@ This is useful for CRM leads for example"),
|
||||
report_xml_pool = self.pool.get('ir.actions.report.xml')
|
||||
template = self.get_email_template(cr, uid, template_id, record_id, context)
|
||||
smtp_server_id = context.get('smtp_server_id', False)
|
||||
if not smtp_server_id:
|
||||
if not smtp_server_id and template.smtp_server_id:
|
||||
smtp_server_id = template.smtp_server_id.id
|
||||
else:
|
||||
smtp_ids = smtp_pool.search(cr, uid, [('default','=',True)])
|
||||
smtp_server_id = smtp_ids and smtp_ids[0]
|
||||
smtp_server = smtp_pool.browse(cr, uid, smtp_server_id, context=context)
|
||||
# determine name of sender, either it is specified in email_id
|
||||
|
||||
@@ -448,15 +452,12 @@ This is useful for CRM leads for example"),
|
||||
|
||||
|
||||
|
||||
def generate_email(self, cr, uid, ids, record_ids, context=None):
|
||||
def generate_email(self, cr, uid, template_id, record_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
email_ids = []
|
||||
for template in self.browse(cr, uid, ids, context=context):
|
||||
for record_id in record_ids:
|
||||
email_id = self._generate_email(cr, uid, template.id, record_id, context)
|
||||
email_ids.append(email_id)
|
||||
return email_ids
|
||||
email_id = self._generate_email(cr, uid, template_id, record_id, context)
|
||||
return email_id
|
||||
|
||||
email_template()
|
||||
|
||||
class email_message(osv.osv):
|
||||
@@ -476,18 +477,20 @@ class email_message(osv.osv):
|
||||
return result
|
||||
|
||||
def email_send(self, cr, uid, email_from, email_to, subject, body, model=False, email_cc=None, email_bcc=None, reply_to=False, attach=None,
|
||||
message_id=False, openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', smtp_server_id=False, context=None):
|
||||
message_id=False, references=False, openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', smtp_server_id=False, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
notemplate = context.get('notemplate', False)
|
||||
notemplate = context.get('notemplate', True)
|
||||
if (not notemplate) and model and openobject_id:
|
||||
template_pool = self.pool.get('email.template')
|
||||
template_ids = template_pool.search(cr, uid, [('model','=',model)])
|
||||
if template_ids and len(template_ids):
|
||||
template_id = template_ids[0]
|
||||
return template_pool.generate_email(cr, uid, [template_id], openobject_id, context=context)
|
||||
return template_pool.generate_email(cr, uid, template_id, openobject_id, context=context)
|
||||
|
||||
return super(email_message, self).email_send(cr, uid, email_from, email_to, subject, body, model=model, email_cc=email_cc, email_bcc=email_bcc, reply_to=reply_to, attach=attach,
|
||||
message_id=message_id, openobject_id=openobject_id, debug=debug, subtype=subtype, x_headers=x_headers, priority=priority, smtp_server_id=smtp_server_id, context=context)
|
||||
message_id=message_id, references=references, openobject_id=openobject_id, debug=debug, subtype=subtype, x_headers=x_headers, priority=priority, smtp_server_id=smtp_server_id, context=context)
|
||||
|
||||
email_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -21,4 +21,5 @@
|
||||
##############################################################################
|
||||
import email_template_preview
|
||||
import email_template_send_wizard
|
||||
import email_compose_message
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# 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
|
||||
from osv import fields
|
||||
import tools
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_name = 'email.compose.message'
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
def _get_templates(self, cr, uid, context=None):
|
||||
"""
|
||||
Return Email Template of particular Model.
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
record_ids = []
|
||||
email_temp_pool = self.pool.get('email.template')
|
||||
model = False
|
||||
if context.get('message_id'):
|
||||
message_pool = self.pool.get('email.message')
|
||||
message_data = message_pool.browse(cr, uid, int(context.get('message_id')), context)
|
||||
model = message_data.model
|
||||
elif context.get('email_model',False):
|
||||
model = context.get('email_model')
|
||||
elif context.get('active_model',False):
|
||||
model = context.get('active_model')
|
||||
if model:
|
||||
record_ids = email_temp_pool.search(cr, uid, [('model','=',model)])
|
||||
return email_temp_pool.name_get(cr, uid, record_ids, context)
|
||||
return []
|
||||
|
||||
_columns = {
|
||||
'template_id': fields.selection(_get_templates, 'Template'),
|
||||
}
|
||||
|
||||
def on_change_template(self, cr, uid, ids, model, resource_id, template_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('mail') == 'reply':
|
||||
return {'value':{}}
|
||||
email_temp_previ_pool = self.pool.get('email_template.preview')
|
||||
result = self.on_change_referred_doc(cr, uid, [], model, resource_id, context=context)
|
||||
vals = result.get('value',{})
|
||||
if template_id:
|
||||
email_temp_pool = self.pool.get('email.template')
|
||||
email_temp_data = email_temp_pool.browse(cr, uid, template_id, context)
|
||||
vals.update({'smtp_server_id': email_temp_data.smtp_server_id and email_temp_data.smtp_server_id.id or False})
|
||||
if template_id and resource_id:
|
||||
context.update({'template_id': template_id})
|
||||
value = email_temp_previ_pool.on_change_ref(cr, uid, [], resource_id, context)
|
||||
new_value = value.get('value',{})
|
||||
if vals.get('email_from'):
|
||||
new_value.get('email_from') and new_value.update({'email_from': new_value.get('email_from') + ',' + vals.get('email_from')}) or vals.get('email_from')
|
||||
|
||||
if vals.get('email_to'):
|
||||
new_value.update({'email_to': new_value.get('email_to') + ',' + vals.get('email_to')}) or vals.get('email_to')
|
||||
|
||||
if vals.get('email_cc'):
|
||||
new_value.get('email_cc') and new_value.update({'email_cc': new_value.get('email_cc') + ',' + vals.get('email_cc')}) or vals.get('email_cc')
|
||||
|
||||
if vals.get('email_bcc'):
|
||||
new_value.get('email_bcc') and new_value.update({'email_bcc': new_value.get('email_bcc') + ',' + vals.get('email_bcc')}) or vals.get('email_bcc')
|
||||
|
||||
if vals.get('reply_to'):
|
||||
new_value.get('reply_to') and new_value.update({'reply_to': new_value.get('reply_to') + ',' + vals.get('reply_to')}) or vals.get('reply_to')
|
||||
|
||||
vals.update(new_value)
|
||||
vals.update({'name': new_value.get('subject','')})
|
||||
return {'value': vals}
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="email_compose_message_wizard_inherit_form">
|
||||
<field name="name">email.compose.message.form</field>
|
||||
<field name="model">email.compose.message</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="emails.email_compose_message_wizard_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="res_id" position="replace">
|
||||
<field name="template_id" colspan="4"
|
||||
on_change="on_change_template(model, res_id, template_id, context)"/>
|
||||
<field name="res_id"
|
||||
invisible="context.get('active_model','') != 'ir.ui.menu'"
|
||||
colspan="4" on_change="on_change_template(model, res_id, template_id, context)"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -22,6 +22,7 @@
|
||||
import email_smtp_server
|
||||
import email_message
|
||||
import res_partner
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
'depends': ['base', 'base_tools'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
"wizard/email_compose_message_view.xml",
|
||||
"email_view.xml",
|
||||
"res_partner_view.xml",
|
||||
'security/ir.model.access.csv',
|
||||
'email_data.xml',
|
||||
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
|
||||
@@ -85,6 +85,10 @@ class email_message_template(osv.osv_memory):
|
||||
'description': fields.text('Description', translate=True),
|
||||
'smtp_server_id':fields.many2one('email.smtp_server', 'SMTP Server'),
|
||||
}
|
||||
_defaults = {
|
||||
'references': lambda * a: None,
|
||||
}
|
||||
|
||||
_sql_constraints = []
|
||||
email_message_template()
|
||||
|
||||
@@ -247,7 +251,7 @@ class email_message(osv.osv):
|
||||
_("Error sending mail: %s") % e)
|
||||
|
||||
def email_send(self, cr, uid, email_from, email_to, subject, body, model=False, email_cc=None, email_bcc=None, reply_to=False, attach=None,
|
||||
message_id=False, openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', smtp_server_id=False, context=None):
|
||||
message_id=False, references=False, openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', smtp_server_id=False, context=None):
|
||||
attachment_obj = self.pool.get('ir.attachment')
|
||||
if email_to and type(email_to) != list:
|
||||
email_to = [email_to]
|
||||
@@ -269,6 +273,7 @@ class email_message(osv.osv):
|
||||
'reply_to': reply_to,
|
||||
'res_id': openobject_id,
|
||||
'message_id': message_id,
|
||||
'references': references,
|
||||
'sub_type': subtype or '',
|
||||
'headers': x_headers or False,
|
||||
'priority': priority,
|
||||
@@ -284,7 +289,7 @@ class email_message(osv.osv):
|
||||
for attachment in attach:
|
||||
attachment_data = {
|
||||
'name': (subject or '') + _(' (Email Attachment)'),
|
||||
'datas': base64.b64encode(attachment[1]),
|
||||
'datas': attachment[1],
|
||||
'datas_fname': attachment[0],
|
||||
'description': subject or _('No Description'),
|
||||
'res_model':'email.message',
|
||||
@@ -327,7 +332,8 @@ class email_message(osv.osv):
|
||||
email_cc=message.email_cc and message.email_cc.split(',') or [],
|
||||
email_bcc=message.email_bcc and message.email_bcc.split(',') or [],
|
||||
reply_to=message.reply_to,
|
||||
attach=attachments, message_id=message.message_id, openobject_id=message.res_id,
|
||||
attach=attachments, message_id=message.message_id, references = message.references,
|
||||
openobject_id=message.res_id,
|
||||
subtype=message.sub_type,
|
||||
x_headers=message.headers and eval(message.headers) or {},
|
||||
priority=message.priority, debug=message.debug,
|
||||
@@ -337,7 +343,7 @@ class email_message(osv.osv):
|
||||
smtp_user=smtp_server and smtp_server.smtpuname or None,
|
||||
smtp_password=smtp_server and smtp_server.smtppass or None)
|
||||
if res:
|
||||
self.write(cr, uid, [message.id], {'state':'sent'}, context)
|
||||
self.write(cr, uid, [message.id], {'state':'sent', 'message_id': res}, context)
|
||||
else:
|
||||
self.write(cr, uid, [message.id], {'state':'exception'}, context)
|
||||
except Exception, error:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<data>
|
||||
|
||||
<menuitem name="Configuration" parent="base.menu_tools"
|
||||
id="base.menu_lunch_survey_root" sequence="20" />
|
||||
id="base.menu_lunch_survey_root" sequence="20"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_email_message_form">
|
||||
<field name="name">email.message.form</field>
|
||||
@@ -31,10 +31,13 @@
|
||||
<separator string="Message Details" colspan="4"/>
|
||||
<field name="model" readonly="1"/>
|
||||
<group col="3" colspan="2">
|
||||
<field name="res_id" readonly="1"/>
|
||||
<field name="res_id" readonly="1"/>
|
||||
<button name="open_document" string="Open Document" type="object" icon="gtk-jump-to"/>
|
||||
<field name="message_id"/>
|
||||
<button name="%(action_email_compose_message_wizard)d" string="Reply" type="action" icon="terp-mail-replied"
|
||||
context="{'mail':'reply', 'message_id':active_id}"/>
|
||||
</group>
|
||||
<field name="references" widget="char" size="4096"/>
|
||||
</group>
|
||||
<separator string="Description" colspan="4"/>
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# 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/>
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,178 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# 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
|
||||
from osv import fields
|
||||
import tools
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_name = 'email.compose.message'
|
||||
_inherit = 'email.message.template'
|
||||
_description = 'This is the wizard for Compose E-mail'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
message_pool = self.pool.get('email.message')
|
||||
message_id = context.get('message_id', False)
|
||||
if message_id:
|
||||
message_data = message_pool.browse(cr, uid, int(message_id), context)
|
||||
if 'message_id' in fields:
|
||||
result['message_id'] = message_data and message_data.message_id
|
||||
|
||||
if 'attachment_ids' in fields:
|
||||
result['attachment_ids'] = message_data and message_pool.read(cr, uid, message_id, ['attachment_ids'])['attachment_ids']
|
||||
|
||||
if 'res_id' in fields:
|
||||
result['res_id'] = message_data and message_data.res_id
|
||||
|
||||
if 'email_from' in fields:
|
||||
result['email_from'] = message_data and message_data.email_from
|
||||
|
||||
if 'email_to' in fields:
|
||||
result['email_to'] = message_data and message_data.email_to
|
||||
|
||||
if 'email_cc' in fields:
|
||||
result['email_cc'] = message_data and message_data.email_cc
|
||||
|
||||
if 'email_bcc' in fields:
|
||||
result['email_bcc'] = message_data and message_data.email_bcc
|
||||
|
||||
if 'name' in fields:
|
||||
result['name'] = tools.ustr(message_data and message_data.name or '')
|
||||
if context.get('mail','') == 'reply':
|
||||
result['name'] = "Re :- " + result['name']
|
||||
|
||||
if 'description' in fields:
|
||||
description = message_data and message_data.description and message_data.description or ''
|
||||
if context.get('mail','') == 'reply':
|
||||
header = '-------- Original Message --------'
|
||||
sender = 'From: %s' % tools.ustr(message_data.email_from or '')
|
||||
email_to = 'To: %s' % tools.ustr(message_data.email_to or '')
|
||||
sentdate = 'Date: %s' % message_data.date
|
||||
desc = '\n > \t %s' % tools.ustr(description.replace('\n', "\n > \t") or '')
|
||||
result['description'] = '\n'.join([header, sender, email_to, sentdate, desc])
|
||||
else:
|
||||
result['description'] = description
|
||||
|
||||
if 'reply_to' in fields:
|
||||
result['reply_to'] = message_data and message_data.reply_to
|
||||
|
||||
if 'model' in fields:
|
||||
result['model'] = message_data and message_data.model
|
||||
|
||||
if 'user_id' in fields:
|
||||
result['user_id'] = message_data and message_data.user_id and message_data.user_id.id or False
|
||||
|
||||
if 'references' in fields:
|
||||
result['references'] = tools.ustr(message_data and message_data.references)
|
||||
|
||||
if 'sub_type' in fields:
|
||||
result['sub_type'] = message_data and message_data.sub_type
|
||||
|
||||
if 'headers' in fields:
|
||||
result['headers'] = message_data and message_data.headers
|
||||
|
||||
if 'priority' in fields:
|
||||
result['priority'] = message_data and message_data.priority
|
||||
|
||||
if 'debug' in fields:
|
||||
result['debug'] = message_data and message_data.debug
|
||||
|
||||
if 'model' in fields and context.get('email_model',False):
|
||||
result['model'] = context.get('email_model')
|
||||
|
||||
return result
|
||||
|
||||
def _get_records(self, cr, uid, context=None):
|
||||
"""
|
||||
Return Records of particular Model
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
record_ids = []
|
||||
model_pool = False
|
||||
if context.get('message_id'):
|
||||
message_pool = self.pool.get('email.message')
|
||||
message_data = message_pool.browse(cr, uid, int(context.get('message_id')), context)
|
||||
model_pool = self.pool.get(message_data.model)
|
||||
record_ids = [message_data.res_id]
|
||||
elif context.get('email_model',False):
|
||||
model = context.get('email_model')
|
||||
model_pool = self.pool.get(model)
|
||||
record_ids = context.get('record_ids',[])
|
||||
if not record_ids:
|
||||
record_ids = model_pool.search(cr, uid, [])
|
||||
elif context.get('active_model',False):
|
||||
model = context.get('active_model')
|
||||
model_pool = self.pool.get(model)
|
||||
record_ids = context.get('active_ids',[])
|
||||
if model_pool:
|
||||
return model_pool.name_get(cr, uid, record_ids, context)
|
||||
return []
|
||||
|
||||
_columns = {
|
||||
'attachment_ids': fields.many2many('ir.attachment','email_message_send_attachment_rel', 'wizard_id', 'attachment_id', 'Attachments'),
|
||||
'debug':fields.boolean('Debug', readonly=True),
|
||||
'res_id':fields.selection(_get_records, 'Referred Document'),
|
||||
}
|
||||
|
||||
def on_change_referred_doc(self, cr, uid, ids, model, resource_id, context=None):
|
||||
return {'value':{}}
|
||||
|
||||
def save_to_drafts(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
email_id = self.save_to_mailbox(cr, uid, ids, context=context)
|
||||
self.pool.get('email.message').write(cr, uid, email_id, {'folder':'drafts', 'state': 'draft'}, context)
|
||||
return {}
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
email_id = self.save_to_mailbox(cr, uid, ids, context)
|
||||
return {}
|
||||
|
||||
def save_to_mailbox(self, cr, uid, ids, context=None):
|
||||
email_ids = []
|
||||
email_message_pool = self.pool.get('email.message')
|
||||
attachment = []
|
||||
for mail in self.browse(cr, uid, ids, context=context):
|
||||
for attach in mail.attachment_ids:
|
||||
attachment.append((attach.datas_fname, attach.datas))
|
||||
references = False
|
||||
message_id = False
|
||||
if context.get('mail',False) == 'reply' and mail.message_id:
|
||||
references = mail.references and str(mail.references) != 'False' and mail.references + "," + mail.message_id or mail.message_id
|
||||
else:
|
||||
message_id = mail.message_id
|
||||
email_id = email_message_pool.email_send(cr, uid, mail.email_from, mail.email_to, mail.name, mail.description,
|
||||
model=mail.model, email_cc=mail.email_cc, email_bcc=mail.email_bcc, reply_to=mail.reply_to,
|
||||
attach=attachment, message_id=message_id, references=references, openobject_id=int(mail.res_id), debug=mail.debug,
|
||||
subtype=mail.sub_type, x_headers=mail.headers, priority=mail.priority, smtp_server_id=mail.smtp_server_id and mail.smtp_server_id.id, context=context)
|
||||
email_ids.append(email_id)
|
||||
return email_ids
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="email_compose_message_wizard_form">
|
||||
<field name="name">email.compose.message.form</field>
|
||||
<field name="model">email.compose.message</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Reply Email">
|
||||
<group col="6" colspan="4">
|
||||
<field name="model" invisible="1"/>
|
||||
<field name="res_id" invisible="context.get('active_model','') != 'ir.ui.menu'"
|
||||
colspan="4" on_change="on_change_referred_doc(model, res_id, context)"/>
|
||||
<field name="smtp_server_id" widget="selection" colspan="4"/>
|
||||
<field name="email_from" colspan="4" required="1"/>
|
||||
<field name="email_to" colspan="4" required="1"/>
|
||||
<field name="email_cc" colspan="4"/>
|
||||
<field name="email_bcc" colspan="4"/>
|
||||
<field name="reply_to" colspan="4"/>
|
||||
<field name="name" colspan="4" widget="char" size="512"/>
|
||||
</group>
|
||||
<separator string="" colspan="4"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Body">
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Attachments">
|
||||
<label string="Add here all attachments of the current document you want to include in the Email." colspan="4"/>
|
||||
<field name="attachment_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="4" colspan="4">
|
||||
<label string="" colspan="1"/>
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-apply" name="save_to_drafts" string="Save in Drafts" type="object"/>
|
||||
<button icon="gtk-ok" name="send_mail" string="Send now" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_email_compose_message_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Send E-mail</field>
|
||||
<field name="res_model">email.compose.message</field>
|
||||
<field name="src_model">email.compose.message</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
+14
-15
@@ -391,11 +391,11 @@
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
<group col="4" colspan="4">
|
||||
@@ -410,11 +410,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -426,14 +425,14 @@
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
<button string="Add Internal Note"
|
||||
<button string="Add Internal Note"
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'event.registration'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"update_xml": [
|
||||
"security/ir.model.access.csv",
|
||||
"security/hr_evaluation_security.xml",
|
||||
"wizard/hr_evaluation_mail_view.xml",
|
||||
# "wizard/hr_evaluation_mail_view.xml",
|
||||
"hr_evaluation_view.xml",
|
||||
"report/hr_evaluation_report_view.xml",
|
||||
"board_hr_evaluation_view.xml"
|
||||
|
||||
@@ -250,12 +250,12 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Evaluation">
|
||||
<group col='10' colspan='4'>
|
||||
<filter icon="terp-check" string="Current" domain="[('state','=','wait'))]" help="Evaluations that are in waiting state"/>
|
||||
<filter icon="terp-check" string="Current" domain="[('state','=','wait'))]" help="Evaluations that are in waiting state"/>
|
||||
<filter icon="terp-camera_test" string="In progress" domain="[('state','=','progress')]" help="Evaluations that are in progress state"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-go-week" string="7 Days" help="Evaluations to close within the next 7 days"
|
||||
domain="[('date', '>=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" />
|
||||
<separator orientation="vertical"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
|
||||
help="Evaluations that overpassed the deadline" domain="[('date','<=',(datetime.date.today()).strftime('%%Y-%%m-%%d'))]" />
|
||||
<separator orientation="vertical"/>
|
||||
@@ -399,17 +399,30 @@
|
||||
<field name="act_window_id" ref="action_hr_evaluation_interview_tree"/>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Email Compose message Action-->
|
||||
<record id="action_email_compose_message_menu_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Send E-mail</field>
|
||||
<field name="res_model">email.compose.message</field>
|
||||
<field name="src_model">email.compose.message</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="context">{'email_model':'hr.evaluation.interview'}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests"
|
||||
action="action_hr_evaluation_interview_tree"/>
|
||||
<menuitem name="Evaluation Reminders" parent="menu_eval_hr" id="menu_eval_send_mail"
|
||||
action="action_hr_evaluation_send_mail" sequence="45" groups="base.group_hr_manager"/>
|
||||
action="action_email_compose_message_menu_wizard" sequence="45" groups="base.group_hr_manager"/>
|
||||
|
||||
<!-- Evaluation Interviews Button on Employee Form -->
|
||||
<act_window
|
||||
<act_window
|
||||
context="{'search_default_user_to_review_id': [active_id]}"
|
||||
id="act_hr_employee_2_hr__evaluation_interview"
|
||||
name="Evaluation Interviews"
|
||||
res_model="hr.evaluation.interview"
|
||||
id="act_hr_employee_2_hr__evaluation_interview"
|
||||
name="Evaluation Interviews"
|
||||
res_model="hr.evaluation.interview"
|
||||
src_model="hr.employee"/>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import hr_evaluation_mail
|
||||
#import hr_evaluation_mail
|
||||
import email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# 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
|
||||
from osv import fields
|
||||
import tools
|
||||
from tools.translate import _
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
if context.get('email_model',False) and context.get('email_model') == 'hr.evaluation.interview' and 'model' in fields:
|
||||
result['model'] = context.get('email_model','')
|
||||
return result
|
||||
|
||||
def _get_records(self, cr, uid, context=None):
|
||||
"""
|
||||
Return Records of particular Model
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
record_ids = []
|
||||
if context.get('email_model',False) and context.get('email_model') == 'hr.evaluation.interview':
|
||||
model_pool = self.pool.get(context.get('email_model'))
|
||||
record_ids = model_pool.search(cr, uid, [('state','=','waiting_answer')])
|
||||
return model_pool.name_get(cr, uid, record_ids, context)
|
||||
else:
|
||||
return super(email_compose_message, self)._get_records(cr, uid, context=context)
|
||||
|
||||
_columns = {
|
||||
'resource_id':fields.selection(_get_records, 'Referred Document'),
|
||||
}
|
||||
|
||||
def on_change_referred_doc(self, cr, uid, ids, model, resource_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('mail') == 'reply':
|
||||
return {'value':{}}
|
||||
result = super(email_compose_message, self).on_change_referred_doc(cr, uid, ids, model, resource_id, context=context)
|
||||
value = {}
|
||||
if not result.get('value'):
|
||||
result.update({'value':{}})
|
||||
|
||||
if model == 'hr.evaluation.interview' and resource_id:
|
||||
model_pool = self.pool.get(model)
|
||||
record_data = model_pool.browse(cr, uid, resource_id, context)
|
||||
if record_data.state == "waiting_answer":
|
||||
msg = _("Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks,") %(record_data.user_to_review_id.name, record_data.survey_id.title)
|
||||
result['value'].update({'email_from': tools.config.get('email_from','')})
|
||||
result['value'].update({'email_to': record_data.user_to_review_id.work_email or False})
|
||||
result['value'].update({'name': _("Reminder to fill up Survey")})
|
||||
result['value'].update({'description': msg })
|
||||
result['value'].update({'res_id': resource_id})
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -145,11 +145,11 @@
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
<group col="4" colspan="4">
|
||||
@@ -164,11 +164,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -180,14 +179,14 @@
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
<button string="Add Internal Note"
|
||||
<button string="Add Internal Note"
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'hr.applicant'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
|
||||
@@ -37,7 +37,7 @@ work done on tasks, eso. It is able to render planning, order tasks, eso.
|
||||
"update_xml": [
|
||||
"security/project_security.xml",
|
||||
"wizard/project_task_delegate_view.xml",
|
||||
"wizard/project_task_close_view.xml",
|
||||
# "wizard/project_task_close_view.xml",
|
||||
"wizard/project_task_reevaluate_view.xml",
|
||||
"security/ir.model.access.csv",
|
||||
"project_data.xml",
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import project_task_close
|
||||
#import project_task_close
|
||||
import email_compose_message
|
||||
import project_task_delegate
|
||||
import project_task_reevaluate
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# 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
|
||||
from osv import fields
|
||||
from tools.translate import _
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
if context.get('active_id',False) and context.get('active_model',False) and context.get('active_model') == 'project.task':
|
||||
task_pool = self.pool.get('project.task')
|
||||
task_data = task_pool.browse(cr, uid, context.get('active_id'), context=context)
|
||||
project = task_data.project_id
|
||||
manager = project.user_id or False
|
||||
partner = task_data.partner_id or task_data.project_id.partner_id
|
||||
|
||||
if project.warn_manager and (not manager or manager and not manager.user_email) :
|
||||
raise osv.except_osv(_('Error'), _("Please specify the Project Manager or email address of Project Manager."))
|
||||
elif project.warn_customer and (not partner or not len(partner.address) or (partner and len(partner.address) and not partner.address[0].email)):
|
||||
raise osv.except_osv(_('Error'), _("Please specify the Customer or email address of Customer."))
|
||||
|
||||
if 'email_from' in fields:
|
||||
result.update({'email_from': task_data.user_id and task_data.user_id.user_email or False})
|
||||
|
||||
if 'description' in fields:
|
||||
val = {
|
||||
'name': task_data.name,
|
||||
'user_id': task_data.user_id.name,
|
||||
'task_id': "%d/%d" % (project.id, task_data.id),
|
||||
'date_start': task_data.date_start,
|
||||
'date': task_data.date_end,
|
||||
'state': task_data.state
|
||||
}
|
||||
header = (project.warn_header or '') % val
|
||||
footer = (project.warn_footer or '') % val
|
||||
description = u'%s\n %s\n %s\n\n \n%s' % (header, task_data.description or '', footer, task_data.user_id and task_data.user_id.signature)
|
||||
result.update({'description': description or False})
|
||||
|
||||
if 'email_to' in fields:
|
||||
result.update({'email_to': manager and manager.user_email or False})
|
||||
|
||||
if partner and len(partner.address) and 'email_to' in fields:
|
||||
result.update({'email_to': result.get('email_to',False) and result.get('email_to') + ',' + partner.address[0].email})
|
||||
|
||||
if 'name' in fields:
|
||||
result.update({'name': _("Task '%s' Closed") % task_data.name})
|
||||
|
||||
if 'model' in fields:
|
||||
result.update({'model':context.get('active_model')})
|
||||
|
||||
if 'res_id' in fields:
|
||||
result.update({'res_id':context.get('active_id')})
|
||||
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -27,7 +27,6 @@ import binascii
|
||||
import time
|
||||
import tools
|
||||
|
||||
|
||||
class project_issue_version(osv.osv):
|
||||
_name = "project.issue.version"
|
||||
_order = "name desc"
|
||||
|
||||
@@ -101,11 +101,11 @@
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
<group col="4" colspan="4">
|
||||
@@ -120,11 +120,10 @@
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
@@ -141,10 +140,10 @@
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'project.issue'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group col="2" colspan="2">
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
<button name="do_reopen" states="done,cancelled" string="Reactivate" type="object" icon="gtk-convert"/>
|
||||
<button name="do_pending" states="open" string="Pending" type="object" icon="gtk-media-pause"/>
|
||||
<button groups="base.group_extended" name="%(project.action_project_task_delegate)d" states="pending,open" string="Delegate" type="action" icon="gtk-sort-descending"/>
|
||||
<button name="%(project.action_project_task_close)d" states="pending,open" string="Done" type="action" icon="gtk-jump-to"/>
|
||||
<button name="%(emails.action_email_compose_message_wizard)d" context="{'mail':'new'}" states="pending,open" string="Done" type="action" icon="gtk-jump-to"/>
|
||||
</group>
|
||||
</page>
|
||||
<page groups="base.group_extended" string="Extra Info" attrs="{'readonly':[('state','=','done')]}">
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
'wizard/project_scrum_backlog_create_task_view.xml',
|
||||
'wizard/project_scrum_backlog_merger_view.xml',
|
||||
'wizard/project_scrum_postpone_view.xml',
|
||||
"wizard/project_scrum_email_view.xml",
|
||||
# "wizard/project_scrum_email_view.xml",
|
||||
'project_scrum_view.xml',
|
||||
'wizard/project_scrum_backlog_sprint_view.xml',
|
||||
'process/project_scrum_process.xml',
|
||||
|
||||
@@ -394,7 +394,9 @@
|
||||
<field name="date"/>
|
||||
<field name="sprint_id" domain="[('state', '=', 'open')]"/>
|
||||
<field name="user_id"/>
|
||||
<button name="%(action_project_scrum_email)d" string="Send Email" type="action" icon="terp-mail-message-new" />
|
||||
<button name="%(emails.action_email_compose_message_wizard)d"
|
||||
string="Send Email" type="action" icon="terp-mail-message-new"
|
||||
context="{'mail':'new'}"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Scrum Meeting">
|
||||
|
||||
@@ -23,7 +23,8 @@ import project_scrum_backlog_create_task
|
||||
import project_scrum_backlog_sprint
|
||||
import project_scrum_backlog_merger
|
||||
import project_scrum_postpone
|
||||
import project_scrum_email
|
||||
#import project_scrum_email
|
||||
import email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# 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
|
||||
from osv import fields
|
||||
from tools.translate import _
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
if context.get('active_id',False) and context.get('active_model',False) and context.get('active_model') == 'project.scrum.meeting':
|
||||
|
||||
meeting_pool = self.pool.get('project.scrum.meeting')
|
||||
user_pool = self.pool.get('res.users')
|
||||
meeting = meeting_pool.browse(cr, uid, context.get('active_id'), context=context)
|
||||
sprint = meeting.sprint_id
|
||||
|
||||
if 'email_from' in fields:
|
||||
user_data = user_pool.browse(cr, uid, uid, context=context)
|
||||
result.update({'email_from': user_data.address_id and user_data.address_id.email or False})
|
||||
|
||||
if 'email_to' in fields and sprint.scrum_master_id and sprint.scrum_master_id.user_email:
|
||||
result.update({'email_to': sprint.scrum_master_id.user_email})
|
||||
|
||||
if sprint.product_owner_id and sprint.product_owner_id.user_email:
|
||||
result.update({'email_to': result.get('email_to',False) and result.get('email_to') + ',' + sprint.product_owner_id.user_email or sprint.product_owner_id.user_email})
|
||||
|
||||
if 'name' in fields:
|
||||
subject = _("Scrum Meeting : %s") %(meeting.date)
|
||||
result.update({'name': subject})
|
||||
|
||||
if 'description' in fields:
|
||||
message = _("Hello , \nI am sending you Scrum Meeting : %s for the Sprint '%s' of Project '%s'") %(meeting.date, sprint.name, sprint.project_id.name)
|
||||
result.update({'description': message})
|
||||
|
||||
if 'model' in fields:
|
||||
result.update({'model':context.get('active_model')})
|
||||
|
||||
if 'res_id' in fields:
|
||||
result.update({'res_id':context.get('active_id')})
|
||||
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
Reference in New Issue
Block a user