@@ -38,10 +38,10 @@ class email_compose_message(osv.osv_memory):
|
||||
model_obj = self.pool.get(model)
|
||||
data = model_obj.browse(cr, uid , resource_id, context)
|
||||
result.update({
|
||||
'name' : data.name or False,
|
||||
'subject' : data.name or False,
|
||||
'email_to' : data.email_from or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
'description' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'body' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'email_cc' : tools.ustr(data.email_cc or ''),
|
||||
'model': model or False,
|
||||
'res_id': resource_id or False,
|
||||
|
||||
@@ -187,13 +187,13 @@
|
||||
<field name="date"/>
|
||||
<field name="email_to" widget="char" size="512"/>
|
||||
<field name="email_cc" widget="char" size="512"/>
|
||||
<field name="name" colspan="4" widget="char" size="512"/>
|
||||
<field name="subject" colspan="4" widget="char" size="512"/>
|
||||
<field name="history" invisible="1"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<field name="body" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
|
||||
@@ -178,13 +178,13 @@
|
||||
<field name="date"/>
|
||||
<field name="email_to" widget="char" size="512"/>
|
||||
<field name="email_cc" widget="char" size="512"/>
|
||||
<field name="name" colspan="4" widget="char" size="512"/>
|
||||
<field name="subject" colspan="4" widget="char" size="512"/>
|
||||
<field name="history" invisible="1"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<field name="body" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
import crm_helpdesk
|
||||
import report
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ from crm import wizard
|
||||
import binascii
|
||||
import tools
|
||||
|
||||
wizard.email_compose_message.email_model.append('crm.helpdesk')
|
||||
CRM_HELPDESK_STATES = (
|
||||
crm.AVAILABLE_STATES[2][0], # Cancelled
|
||||
crm.AVAILABLE_STATES[3][0], # Done
|
||||
|
||||
@@ -112,13 +112,13 @@
|
||||
<field name="date"/>
|
||||
<field name="email_to" widget="char" size="512"/>
|
||||
<field name="email_cc" widget="char" size="512"/>
|
||||
<field name="name" colspan="4" widget="char" size="512"/>
|
||||
<field name="subject" colspan="4" widget="char" size="512"/>
|
||||
<field name="history" invisible="1"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<field name="body" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# -*- 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 get_value(self, cr, uid, model, resource_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context)
|
||||
if model == 'crm.helpdesk' and resource_id:
|
||||
model_obj = self.pool.get(model)
|
||||
data = model_obj.browse(cr, uid , resource_id, context)
|
||||
result.update({
|
||||
'subject' : data.name or False,
|
||||
'email_to' : data.email_from or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
'body' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'email_cc' : tools.ustr(data.email_cc or ''),
|
||||
'model': model or False,
|
||||
'res_id': resource_id or False,
|
||||
})
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -75,7 +75,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
|
||||
sender = 'From: %s' %(hist.email_from or '')
|
||||
to = 'To: %s' % (hist.email_to or '')
|
||||
sentdate = 'Date: %s' % (hist.date or '')
|
||||
desc = '\n%s'%(hist.description)
|
||||
desc = '\n%s'%(hist.body)
|
||||
original = [header, sender, to, sentdate, desc]
|
||||
original = '\n'.join(original)
|
||||
return original
|
||||
@@ -171,13 +171,6 @@ class crm_lead_forward_to_partner(osv.osv_memory):
|
||||
email = self.pool.get('res.partner.address').browse(cr, uid, address_id).email
|
||||
return {'value': {'email_to' : email}}
|
||||
|
||||
def save_to_drafts(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
super(crm_lead_forward_to_partner, self).save_to_drafts(cr, uid, ids, context=context)
|
||||
self.action_forward(cr, uid, ids, context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
<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"/>
|
||||
<field name="subject" colspan="4" widget="char" size="512"/>
|
||||
</group>
|
||||
<separator string="" colspan="4"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Body">
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<field name="body" 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"/>
|
||||
@@ -46,7 +46,6 @@
|
||||
<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>
|
||||
|
||||
@@ -62,8 +62,8 @@ class email_compose_message(osv.osv_memory):
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
template_id = context.get('template_id', False)
|
||||
vals = {}
|
||||
if template_id and context.get('email_model') and context.get('email_res_id'):
|
||||
vals = self.get_template_data(cr, uid, context.get('email_res_id'), template_id, context)
|
||||
if template_id and context.get('active_model') and context.get('active_id'):
|
||||
vals = self.get_template_data(cr, uid, context.get('active_id'), template_id, context)
|
||||
|
||||
if not vals:
|
||||
return result
|
||||
@@ -116,8 +116,8 @@ class email_compose_message(osv.osv_memory):
|
||||
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) + [(False,'')]
|
||||
@@ -127,13 +127,13 @@ class email_compose_message(osv.osv_memory):
|
||||
'template_id': fields.selection(_get_templates, 'Template'),
|
||||
}
|
||||
|
||||
def on_change_template(self, cr, uid, ids, model, resource_id, template_id, context=None):
|
||||
def on_change_template(self, cr, uid, ids, model, template_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('mail') == 'reply':
|
||||
return {'value':{}}
|
||||
result = self.on_change_referred_doc(cr, uid, [], model, resource_id, context=context)
|
||||
vals = result.get('value',{})
|
||||
vals = {}
|
||||
resource_id = context.get('active_id', False)
|
||||
if template_id and resource_id:
|
||||
vals.update(self.get_template_data(cr, uid, resource_id, template_id, context))
|
||||
else:
|
||||
|
||||
@@ -8,12 +8,9 @@
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="res_id" position="replace">
|
||||
<field name="model" position="after">
|
||||
<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)"/>
|
||||
on_change="on_change_template(model, template_id, context)"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -128,13 +128,6 @@ class email_template_send_wizard(osv.osv_memory):
|
||||
# result['attachment_ids']['domain'] = [('res_model','=',context['src_model']),('res_id','=',context['active_id'])]
|
||||
# return result
|
||||
|
||||
def save_to_drafts(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
mailid = self.save_to_mailbox(cr, uid, ids, context=context)
|
||||
self.pool.get('email.message').write(cr, uid, mailid, {'state': 'outgoing'}, context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<field name="attachment_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
|
||||
</group>
|
||||
<field name="state" invisible="1"/>
|
||||
<group col="4" colspan="4" attrs="{'invisible':[('state','=','single')]}">
|
||||
@@ -52,12 +52,8 @@
|
||||
</group>
|
||||
<group col="4" colspan="2" attrs="{'invisible':[('state','!=','single')]}">
|
||||
<button icon="gtk-cancel" special="cancel" string="Discard"/>
|
||||
<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>
|
||||
|
||||
@@ -27,7 +27,6 @@ from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
from crm import wizard
|
||||
|
||||
wizard.email_compose_message.email_model.append('event.registration')
|
||||
|
||||
class event_type(osv.osv):
|
||||
""" Event Type """
|
||||
|
||||
@@ -403,13 +403,13 @@
|
||||
<field name="date"/>
|
||||
<field name="email_to" widget="char" size="512"/>
|
||||
<field name="email_cc" widget="char" size="512"/>
|
||||
<field name="name" colspan="4" widget="char" size="512"/>
|
||||
<field name="subject" colspan="4" widget="char" size="512"/>
|
||||
<field name="history" invisible="1"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<field name="body" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
|
||||
@@ -23,4 +23,5 @@ import event_make_invoice
|
||||
import event_confirm_registration
|
||||
import event_confirm
|
||||
import partner_event_registration
|
||||
import email_compose_message
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# -*- 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 get_value(self, cr, uid, model, resource_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context)
|
||||
if model == 'event.registration' and resource_id:
|
||||
model_obj = self.pool.get(model)
|
||||
data = model_obj.browse(cr, uid , resource_id, context)
|
||||
result.update({
|
||||
'subject' : data.event_id.name or False,
|
||||
'email_to' : data.email_from or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
'body' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'email_cc' : tools.ustr(data.email_cc or ''),
|
||||
'model': model or False,
|
||||
'res_id': resource_id or False,
|
||||
})
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -27,24 +27,6 @@ from tools.translate import _
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
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 = {
|
||||
'res_id':fields.selection(_get_records, 'Referred Document'),
|
||||
}
|
||||
|
||||
def get_value(self, cr, uid, model, resource_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -57,8 +39,8 @@ class email_compose_message(osv.osv_memory):
|
||||
result.update({
|
||||
'email_from': tools.config.get('email_from',''),
|
||||
'email_to': record_data.user_to_review_id.work_email or False,
|
||||
'name': _("Reminder to fill up Survey"),
|
||||
'description': msg,
|
||||
'subject': _("Reminder to fill up Survey"),
|
||||
'body': msg,
|
||||
'res_id': resource_id,
|
||||
'email_cc': False,
|
||||
'email_bcc': False,
|
||||
|
||||
@@ -31,8 +31,6 @@ import tools
|
||||
from tools.translate import _
|
||||
from crm import wizard
|
||||
|
||||
wizard.email_compose_message.email_model.append('hr.applicant')
|
||||
|
||||
AVAILABLE_STATES = [
|
||||
('draft', 'New'),
|
||||
('open', 'In Progress'),
|
||||
|
||||
@@ -157,13 +157,13 @@
|
||||
<field name="date"/>
|
||||
<field name="email_to" widget="char" size="512"/>
|
||||
<field name="email_cc" widget="char" size="512"/>
|
||||
<field name="name" colspan="4" widget="char" size="512"/>
|
||||
<field name="subject" colspan="4" widget="char" size="512"/>
|
||||
<field name="history" invisible="1"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<field name="body" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
import hr_recruitment_phonecall
|
||||
import hr_recruitment_create_partner_job
|
||||
import hr_recruitment_employee_hired
|
||||
import email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# -*- 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 get_value(self, cr, uid, model, resource_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context)
|
||||
if model == 'hr.applicant' and resource_id:
|
||||
model_obj = self.pool.get(model)
|
||||
data = model_obj.browse(cr, uid , resource_id, context)
|
||||
result.update({
|
||||
'subject' : data.name or False,
|
||||
'email_to' : data.email_from or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
'body' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'email_cc' : tools.ustr(data.email_cc or ''),
|
||||
'model': model or False,
|
||||
'res_id': resource_id or False,
|
||||
})
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -33,12 +33,14 @@ class email_compose_message(osv.osv_memory):
|
||||
context = {}
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
vals = {}
|
||||
if context.get('email_model') and context.get('email_res_id'):
|
||||
vals = self.get_value(cr, uid, context.get('email_model'), context.get('email_res_id'), context)
|
||||
elif context.get('message_id', False):
|
||||
vals = self.get_message_data(cr, uid, int(context.get('message_id', False)), context)
|
||||
if context.get('active_model') and context.get('active_id') and not context.get('mail')=='reply':
|
||||
vals = self.get_value(cr, uid, context.get('active_model'), context.get('active_id'), context)
|
||||
|
||||
elif context.get('mail')=='reply' and context.get('active_id', False):
|
||||
vals = self.get_message_data(cr, uid, int(context.get('active_id', False)), context)
|
||||
|
||||
else:
|
||||
result['model'] = context.get('email_model', False)
|
||||
result['model'] = context.get('active_model', False)
|
||||
|
||||
if not vals:
|
||||
return result
|
||||
@@ -96,33 +98,8 @@ class email_compose_message(osv.osv_memory):
|
||||
|
||||
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('email_res_id') and [context.get('email_res_id')] or []
|
||||
if not record_ids:
|
||||
record_ids = model_pool.search(cr, uid, [])
|
||||
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 get_value(self, cr, uid, model, res_id, context=None):
|
||||
@@ -171,40 +148,48 @@ class email_compose_message(osv.osv_memory):
|
||||
|
||||
return result
|
||||
|
||||
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 = {}
|
||||
if resource_id and model:
|
||||
vals = self.get_value(cr, uid, model, resource_id, context)
|
||||
if vals:
|
||||
result.update({
|
||||
'email_from': vals.get('email_from',''),
|
||||
'email_to': vals.get('email_to',''),
|
||||
'subject': vals.get('subject',''),
|
||||
'body': vals.get('body',''),
|
||||
'email_cc': vals.get('email_cc',''),
|
||||
'email_bcc': vals.get('email_bcc',''),
|
||||
'reply_to': vals.get('reply_to',''),
|
||||
})
|
||||
return {'value': result}
|
||||
|
||||
|
||||
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, {'state': 'outgoing'}, context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
record = self.browse(cr, uid, ids[0], context=context)
|
||||
if context.get('mass_mail') and context['active_ids'] and context.get('template_id'):
|
||||
email_message_pool = self.pool.get('email.message')
|
||||
email_temp_pool = self.pool.get('email.template')
|
||||
for res_id in context['active_ids']:
|
||||
subject = email_temp_pool.get_template_value(cr, uid, record.subject, context['active_model'], res_id)
|
||||
body = email_temp_pool.get_template_value(cr, uid, record.body, context['active_model'], res_id)
|
||||
email_to = email_temp_pool.get_template_value(cr, uid, record.email_to, context['active_model'], res_id)
|
||||
email_from = email_temp_pool.get_template_value(cr, uid, record.email_from, context['active_model'], res_id)
|
||||
email_cc = email_temp_pool.get_template_value(cr, uid, record.email_cc, context['active_model'], res_id)
|
||||
reply_to = email_temp_pool.get_template_value(cr, uid, record.reply_to, context['active_model'], res_id)
|
||||
|
||||
email_id = email_message_pool.schedule_with_attach(cr, uid, email_from,
|
||||
email_to, subject or False, body or False, context['active_model'], email_cc or False, openobject_id=int(res_id),
|
||||
context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
if context.get('mass_mail') and context.get('active_ids') and not context.get('template_id'):
|
||||
self.do_mass_mail(cr, uid, context['active_ids'], record.subject or False, record.body or False, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
email_id = self.save_to_mailbox(cr, uid, ids, context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def do_mass_mail(self, cr, uid, ids, subject, body, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if context.get('active_model'):
|
||||
email_message_pool = self.pool.get('email.message')
|
||||
model_pool = self.pool.get(context['active_model'])
|
||||
for data in model_pool.browse(cr, uid, ids, context=context):
|
||||
email_id = email_message_pool.schedule_with_attach(cr, uid,
|
||||
data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
data.email_from or False, subject, body, model=context['active_model'],
|
||||
email_cc=tools.ustr(data.email_cc or ''), openobject_id=int(data.id), context=context)
|
||||
return True
|
||||
|
||||
def save_to_mailbox(self, cr, uid, ids, context=None):
|
||||
email_ids = []
|
||||
email_message_pool = self.pool.get('email.message')
|
||||
@@ -220,7 +205,7 @@ class email_compose_message(osv.osv_memory):
|
||||
message_id = mail.message_id
|
||||
email_id = email_message_pool.schedule_with_attach(cr, uid, mail.email_from, mail.email_to, mail.subject, mail.body,
|
||||
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,
|
||||
attach=attachment, message_id=message_id, references=references, openobject_id=int(mail.res_id),
|
||||
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
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
<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"/>
|
||||
@@ -33,7 +31,6 @@
|
||||
<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>
|
||||
|
||||
@@ -54,9 +54,9 @@ class email_compose_message(osv.osv_memory):
|
||||
if partner and len(partner.address):
|
||||
result.update({'email_to': result.get('email_to',False) and result.get('email_to') + ',' + partner.address[0].email})
|
||||
result.update({
|
||||
'description': description or False,
|
||||
'body': description or False,
|
||||
'email_to': task_data.project_id.user_id and task_data.project_id.user_id.user_email or False,
|
||||
'name': _("Task '%s' Closed") % task_data.name,
|
||||
'subject': _("Task '%s' Closed") % task_data.name,
|
||||
'model': model,
|
||||
'res_id': resource_id,
|
||||
})
|
||||
|
||||
@@ -28,8 +28,6 @@ import time
|
||||
import tools
|
||||
from crm import wizard
|
||||
|
||||
wizard.email_compose_message.email_model.append('project.issue')
|
||||
|
||||
class project_issue_version(osv.osv):
|
||||
_name = "project.issue.version"
|
||||
_order = "name desc"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,49 @@
|
||||
# -*- 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 get_value(self, cr, uid, model, resource_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context)
|
||||
if model == 'project.issue' and resource_id:
|
||||
model_obj = self.pool.get(model)
|
||||
data = model_obj.browse(cr, uid , resource_id, context)
|
||||
result.update({
|
||||
'subject' : data.name or False,
|
||||
'email_to' : data.email_from or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
'body' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'email_cc' : tools.ustr(data.email_cc or ''),
|
||||
'model': model or False,
|
||||
'res_id': resource_id or False,
|
||||
})
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -21,5 +21,6 @@
|
||||
|
||||
import project_planning
|
||||
import report
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,48 @@
|
||||
# -*- 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 get_value(self, cr, uid, model, resource_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context)
|
||||
if model == 'project.task' and resource_id:
|
||||
model_obj = self.pool.get(model)
|
||||
data = model_obj.browse(cr, uid , resource_id, context)
|
||||
result.update({
|
||||
'subject' : data.name or False,
|
||||
'email_to' : data.user_id.user_email or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
'body' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'model': model or False,
|
||||
'res_id': resource_id or False,
|
||||
})
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -47,8 +47,8 @@ class email_compose_message(osv.osv_memory):
|
||||
subject = _("Scrum Meeting : %s") %(meeting.date)
|
||||
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({
|
||||
'name': subject,
|
||||
'description': message,
|
||||
'subject': subject,
|
||||
'body': message,
|
||||
'model': model,
|
||||
'res_id': resource_id
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user