diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py
index 25a4c0839b2..9567d449d9f 100644
--- a/addons/crm/__terp__.py
+++ b/addons/crm/__terp__.py
@@ -71,7 +71,8 @@ between mails and Open ERP.""",
'wizard/crm_opportunity_to_meeting_view.xml',
'wizard/crm_opportunity_to_phonecall_view.xml',
-
+
+ 'wizard/crm_send_new_email_view.xml',
'crm_wizard.xml',
'crm_view.xml',
diff --git a/addons/crm/crm_claims_view.xml b/addons/crm/crm_claims_view.xml
index f51f6890d0c..181769c1bc1 100644
--- a/addons/crm/crm_claims_view.xml
+++ b/addons/crm/crm_claims_view.xml
@@ -157,7 +157,11 @@
-
+
@@ -165,8 +169,11 @@
-
-
+
+
diff --git a/addons/crm/crm_fund_view.xml b/addons/crm/crm_fund_view.xml
index a78d5e3eeb6..e08f5f09413 100644
--- a/addons/crm/crm_fund_view.xml
+++ b/addons/crm/crm_fund_view.xml
@@ -155,15 +155,22 @@
-
-
+
+
-
+
diff --git a/addons/crm/crm_helpdesk_view.xml b/addons/crm/crm_helpdesk_view.xml
index ec662885a04..87d0f6df757 100644
--- a/addons/crm/crm_helpdesk_view.xml
+++ b/addons/crm/crm_helpdesk_view.xml
@@ -103,7 +103,11 @@
-
+
@@ -111,7 +115,10 @@
-
+
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 9b040763809..640f6d32d56 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -124,8 +124,13 @@
icon="gtk-add" type="action"/>
-
-
+
+
@@ -134,8 +139,8 @@
diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml
index 318cd353c69..dfe02ff1eea 100644
--- a/addons/crm/crm_opportunity_view.xml
+++ b/addons/crm/crm_opportunity_view.xml
@@ -147,7 +147,11 @@
-
+
@@ -155,7 +159,10 @@
-
+
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml
index e783e10c658..7af6ebcc868 100644
--- a/addons/crm/crm_view.xml
+++ b/addons/crm/crm_view.xml
@@ -4,11 +4,6 @@
-
-
-
crm.case.section.form
@@ -353,7 +348,11 @@
-
+
@@ -361,7 +360,10 @@
-
+
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index 4ab5e00ad67..0a74cfebc30 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -19,10 +19,7 @@
#
##############################################################################
-import crm_phonecall_wizard
-
-import wizard_crm_send_email
-import wizard_crm_new_send_email
+import crm_send_new_email
import wizard_history_event
import crm_lead_to_partner
diff --git a/addons/crm/wizard/crm_phonecall_wizard.py b/addons/crm/wizard/crm_phonecall_wizard.py
deleted file mode 100644
index 9fcec41936e..00000000000
--- a/addons/crm/wizard/crm_phonecall_wizard.py
+++ /dev/null
@@ -1,314 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from mx.DateTime import now
-
-import wizard
-import netsvc
-import ir
-import pooler
-from tools.translate import _
-
-class partner_create(wizard.interface):
-
- case_form = """
- """
-
- case_fields = {
- 'close': {'type':'boolean', 'string':'Close Phonecall'}
- }
-
- partner_form = """
- """
-
- partner_fields = {
- 'action': {'type':'selection',
- 'selection':[('exist','Link to an existing partner'),('create','Create a new partner')],
- 'string':'Action', 'required':True, 'default': lambda *a:'exist'},
- 'partner_id' : {'type':'many2one', 'relation':'res.partner', 'string':'Partner'},
- }
-
- def _selectPartner(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- case_obj = pool.get('crm.phonecall')
- for case in case_obj.browse(cr, uid, data['ids']):
- if case.partner_id:
- raise wizard.except_wizard(_('Warning !'),
- _('A partner is already defined on this phonecall.'))
- return {}
-
- def _create_partner(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- case_obj = pool.get('crm.phonecall')
- partner_obj = pool.get('res.partner')
- contact_obj = pool.get('res.partner.address')
- partner_ids = []
- partner_id = False
- contact_id = False
- for case in case_obj.browse(cr, uid, data['ids']):
- if data['form']['action'] == 'create':
- partner_id = partner_obj.create(cr, uid, {
- 'name': case.partner_contact or case.name,
- 'user_id': case.user_id.id,
- 'comment': case.description,
- })
- contact_id = contact_obj.create(cr, uid, {
- 'partner_id': partner_id,
- 'name': case.name,
- 'phone': case.partner_phone,
- 'mobile': case.partner_mobile,
- 'email': case.email_from
- })
-
- else:
- if data['form']['partner_id']:
- partner = partner_obj.browse(cr,uid,data['form']['partner_id'])
- partner_id = partner.id
- contact_id = partner.address and partner.address[0].id
-
- partner_ids.append(partner_id)
- vals = {}
- if partner_id:
- vals.update({'partner_id': partner_id})
- if contact_id:
- vals.update({'partner_address_id': contact_id})
- case_obj.write(cr, uid, [case.id], vals)
- return partner_ids
-
- def _make_partner(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- partner_ids = self._create_partner(cr, uid, data, context)
- mod_obj = pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
- res = mod_obj.read(cr, uid, result, ['res_id'])
- value = {
- 'domain': "[]",
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'res.partner',
- 'res_id': partner_ids and int(partner_ids[0]) or False,
- 'view_id': False,
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
- return value
-
- states = {
- 'init': {
- 'actions': [_selectPartner],
- 'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
- 'state' : [('end', 'Cancel', 'gtk-cancel'),('create_partner', 'Create Partner', 'gtk-go-forward')]}
- },
- 'create_partner': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': partner_form, 'fields': partner_fields,
- 'state' : [('end', 'Cancel', 'gtk-cancel'),('create', 'Continue', 'gtk-go-forward')]}
- },
- 'create': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _make_partner, 'state': 'end'}
- }
- }
-
-
-partner_create('crm.phonecall.partner_create')
-
-class phonecall2opportunity(partner_create):
-
- case_form = """
- """
-
- case_fields = {
- 'name': {'type':'char', 'size':64, 'string':'Opportunity Summary', 'required':True},
- 'planned_revenue': {'type':'float', 'digits':(16,2), 'string': 'Expected Revenue'},
- 'probability': {'type':'float', 'digits':(16,2), 'string': 'Success Probability'},
- 'partner_id' : {'type':'many2one', 'relation':'res.partner', 'string':'Partner'},
- }
-
- def _check_state(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- case_obj = pool.get('crm.phonecall')
- for case in case_obj.browse(cr, uid, data['ids']):
- if case.state in ['done', 'cancel']:
- raise wizard.except_wizard(_('Warning !'),
- _('Closed/Cancelled Phone Call Could not convert into Opportunity.'))
- return {}
-
- def _selectopportunity(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- case_obj = pool.get('crm.phonecall')
- case = case_obj.browse(cr, uid, data['id'])
- return {'name': case.name, 'partner_id':case.partner_id and case.partner_id.id or False}
-
- def _selectChoice(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- case_obj = pool.get('crm.phonecall')
- for case in case_obj.browse(cr, uid, data['ids']):
- if not case.partner_id:
- return 'create_partner'
- return 'opportunity'
-
- def _makeOrder(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- data_obj = pool.get('ir.model.data')
- result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
- res = data_obj.read(cr, uid, result, ['res_id'])
-
-
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_oppor')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_oppor')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
- phonecall_case_obj = pool.get('crm.phonecall')
- opportunity_case_obj = pool.get('crm.opportunity')
- for phonecall in phonecall_case_obj.browse(cr, uid, data['ids']):
- new_opportunity_id = opportunity_case_obj.create(cr, uid, {
- 'name': data['form']['name'],
- 'planned_revenue': data['form']['planned_revenue'],
- 'probability': data['form']['probability'],
- 'partner_id': data['form']['partner_id'],
- 'section_id': phonecall.section_id.id,
- 'description': phonecall.description,
- 'phonecall_id': phonecall.id,
- 'priority': phonecall.priority,
- 'phone': phonecall.partner_phone,
- })
- new_opportunity = opportunity_case_obj.browse(cr, uid, new_opportunity_id)
- vals = {
- 'partner_id': data['form']['partner_id'],
- 'opportunity_id' : new_opportunity_id,
- }
- phonecall_case_obj.write(cr, uid, [phonecall.id], vals)
- phonecall_case_obj.case_close(cr, uid, [phonecall.id])
- opportunity_case_obj.case_open(cr, uid, [new_opportunity_id])
- value = {
- 'name': _('Opportunity'),
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'crm.opportunity',
- 'res_id': int(new_opportunity_id),
- 'view_id': False,
- 'views': [(id2,'form'),(id3,'tree'),(False,'calendar'),(False,'graph')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
- return value
-
- def _makePartner(self, cr, uid, data, context):
- partner_ids = self._create_partner(cr, uid, data, context)
- return {}
-
- states = {
- 'init': {
- 'actions': [_check_state],
- 'result': {'type':'choice','next_state':_selectChoice}
- },
- 'create_partner': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': partner_create.partner_form, 'fields': partner_create.partner_fields,
- 'state' : [('end', 'Cancel', 'gtk-cancel'),('opportunity', 'Skip', 'gtk-goto-last'),('create', 'Continue', 'gtk-go-forward')]}
- },
- 'create': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _makePartner, 'state':'opportunity' }
- },
- 'opportunity': {
- 'actions': [_selectopportunity],
- 'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
- 'state' : [('end', 'Cancel', 'gtk-cancel'),('confirm', 'Create Opportunity', 'gtk-go-forward')]}
- },
- 'confirm': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _makeOrder, 'state': 'end'}
- }
- }
-
-phonecall2opportunity('crm.phonecall.opportunity_set')
-
-class phonecall2meeting(wizard.interface):
-
- def _makeMeeting(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- phonecall_case_obj = pool.get('crm.phonecall')
- data_obj = pool.get('ir.model.data')
- result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
- id = data_obj.read(cr, uid, result, ['res_id'])
- id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
- if id1:
- id1 = data_obj.browse(cr, uid, id1, context=context).res_id
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
- phonecall = phonecall_case_obj.browse(cr, uid, data['id'], context=context)
- partner_id = phonecall.partner_id and phonecall.partner_id.id or False
- name = phonecall.name
- email = phonecall.email_from
- section_id = phonecall.section_id and phonecall.section_id.id or False
- return {
- 'name': _('Meetings'),
- 'domain' : "[('user_id','=',%s)]"%(uid),
- 'context': {'default_partner_id': partner_id, 'default_section_id': section_id, 'default_email_from': email, 'default_state':'open', 'default_name':name},
- 'view_type': 'form',
- 'view_mode': 'calendar,form,tree',
- 'res_model': 'crm.meeting',
- 'view_id': False,
- 'views': [(id1,'calendar'),(id2,'form'),(id3,'tree')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _makeMeeting, 'state': 'order'}
- },
- 'order': {
- 'actions': [],
- 'result': {'type': 'state', 'state': 'end'}
- }
- }
-phonecall2meeting('crm.phonecall.meeting_set')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_send_new_email.py b/addons/crm/wizard/crm_send_new_email.py
new file mode 100644
index 00000000000..3687d23a5a3
--- /dev/null
+++ b/addons/crm/wizard/crm_send_new_email.py
@@ -0,0 +1,220 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# 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 .
+#
+##############################################################################
+
+from mx.DateTime import now
+
+import wizard
+import netsvc
+import ir
+import pooler
+import tools
+import base64
+from tools.translate import _
+from osv import osv, fields
+
+class crm_send_new_email(osv.osv_memory):
+ """ Sends new email for the case"""
+ _name = "crm.send.new.mail"
+ _description = "Case Send new email"
+
+ _columns = {
+ 'to' : fields.char('To', size=64, required=True),
+ 'cc' : fields.char('CC', size=128),
+ 'subject' : fields.char('Subject', size=128, required=True),
+ 'text' : fields.text('Message', required=True),
+ 'state': fields.selection([('done', 'Done'), ('pending', 'Pending'), ('unchanged', 'Unchanged')], string='State', required=True),
+ 'doc1': fields.binary("Attachment1"),
+ 'doc2': fields.binary("Attachment2"),
+ 'doc3': fields.binary("Attachment3"),
+ }
+
+ def action_cancel(self, cr, uid, ids, context=None):
+ """
+ Closes Phonecall to Opportunity form
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Phonecall to Opportunity's IDs
+ @param context: A standard dictionary for contextual values
+ """
+ return {'type':'ir.actions.act_window_close'}
+
+ def action_send(self, cr, uid, ids, context=None):
+ """ This sends an email to ALL the addresses of the selected partners.
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Phonecall to Opportunity's IDs
+ @param context: A standard dictionary for contextual values
+ """
+ if not context:
+ context = {}
+
+ if not context.get('model'):
+ raise osv.except_osv(_('Error'), _('Can not send mail!'))
+
+ model = context.get('model')
+ case_pool = self.pool.get(model)
+ res_id = context and context.get('active_id', False) or False
+
+ for data in self.read(cr, uid, ids, context=context):
+ attach = filter(lambda x: x, [data['doc1'], data['doc2'], data['doc3']])
+ attach = map(lambda x: x and ('Attachment'+str(attach.index(x)+1), base64.decodestring(x)), attach)
+
+ if context.get('mail', 'new') == 'new':
+ case = case_pool.browse(cr, uid, res_id)
+ else:
+ hist_obj = self.pool.get('crm.case.history')
+ hist = hist_obj.browse(cr, uid, res_id)
+ model = hist.log_id.model_id.model
+ model_pool = self.pool.get(model)
+ case = model_pool.browse(cr, uid, hist.log_id.res_id)
+ emails = [data['to']] + (data['cc'] or '').split(',')
+ emails = filter(None, emails)
+ body = data['text']
+
+ if case.user_id.signature:
+ body += '\n\n%s' % (case.user_id.signature)
+
+ case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['to'], details=body)
+
+ flag = tools.email_send(
+ case.user_id.address_id.email,
+ emails,
+ data['subject'],
+ case_pool.format_body(body),
+ attach=attach,
+ reply_to=case.section_id.reply_to,
+ openobject_id=str(case.id),
+ subtype="html"
+ )
+ if flag:
+ if data['state'] == 'unchanged':
+ pass
+ elif data['state'] == 'done':
+ case_pool.case_close(cr, uid, [data['id']])
+ elif data['state'] == 'pending':
+ case_pool.case_pending(cr, uid, [data['id']])
+ cr.commit()
+
+# Commented because form does not close due to raise
+# raise osv.except_osv(_('Email!'), ("Email Successfully Sent"))
+# else:
+# raise osv.except_osv(_('Warning!'), _("Email not sent !"))
+ return {}
+
+ def default_get(self, cr, uid, fields, context=None):
+ """
+ This function gets default values
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param fields: List of fields for default value
+ @param context: A standard dictionary for contextual values
+
+ @return : default values of fields.
+ """
+ if not context:
+ context = {}
+
+ if not context.get('model'):
+ raise osv.except_osv(_('Error'), _('Can not send mail!'))
+
+ res = super(crm_send_new_email, self).default_get(cr, uid, fields, context=context)
+
+ if context.get('mail') == 'reply':
+ res.update(self.get_reply_defaults(cr, uid, fields, context=context))
+ return res
+
+ model = context.get('model')
+ mod_obj = self.pool.get(model)
+ res_id = context and context.get('active_ids', []) or []
+
+ for case in mod_obj.browse(cr, uid, res_id):
+ if 'to' in fields:
+ res.update({'to': case.email_from})
+ if 'subject' in fields:
+ res.update({'subject': case.name})
+ if 'cc' in fields:
+ res.update({'cc': case.email_cc or ''})
+ if 'text' in fields:
+ res.update({'text': case.description or ''})
+ if 'state' in fields:
+ res.update({'state': 'done'})
+ return res
+
+ def get_reply_defaults(self, cr, uid, fields, context=None):
+ """
+ This function gets default values for reply mail
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param fields: List of fields for default value
+ @param context: A standard dictionary for contextual values
+
+ @return : default values of fields.
+ """
+ hist_obj = self.pool.get('crm.case.history')
+ res_ids = context and context.get('active_ids', []) or []
+ res = {}
+ for hist in hist_obj.browse(cr, uid, res_ids):
+ model = hist.log_id.model_id.model
+ model_pool = self.pool.get(model)
+ case = model_pool.browse(cr, uid, hist.log_id.res_id)
+ if 'to' in fields:
+ res.update({'to': hist.email})
+ if 'text' in fields:
+ res.update({'text': '>' + hist.description.replace('\n', '\n> ')})
+ if 'subject' in fields:
+ res.update({'subject': case.name or ''})
+ return res
+
+ def view_init(self, cr, uid, fields_list, context=None):
+ """
+ This function checks for precondition before wizard executes
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param fields: List of fields for default value
+ @param context: A standard dictionary for contextual values
+
+ """
+ if not context:
+ context = {}
+
+ if not context.get('model'):
+ raise osv.except_osv(_('Error'), _('Can not send mail!'))
+ model = context.get('model')
+ mod_obj = self.pool.get(model)
+ if context.get('mail') == 'reply':
+ return True
+ for case in mod_obj.browse(cr, uid, context.get('active_ids', [])):
+ if not case.user_id:
+ raise osv.except_osv(_('Error'), _('You must define a responsible user for this case in order to use this action!'))
+ if not case.user_id.address_id.email:
+ raise osv.except_osv(_('Warning!'), _("Please specify user's email address !"))
+
+ return True
+
+crm_send_new_email()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_send_new_email_view.xml b/addons/crm/wizard/crm_send_new_email_view.xml
new file mode 100644
index 00000000000..5411bf72af0
--- /dev/null
+++ b/addons/crm/wizard/crm_send_new_email_view.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+ crm.new.send.mail.form
+ crm.send.new.mail
+ form
+
+
+
+
+
+
+
+
+ Send New Mail
+ crm.send.new.mail
+ form
+ form
+
+ new
+
+
+
+
+
+
+ crm.new.send.mail.form
+ crm.send.new.mail
+ form
+
+
+
+
+
+
+
+
+ Reply to last Mail
+ crm.send.new.mail
+ form
+ form
+
+ new
+
+
+
+
\ No newline at end of file
diff --git a/addons/crm/wizard/wizard_crm_new_send_email.py b/addons/crm/wizard/wizard_crm_new_send_email.py
deleted file mode 100644
index ef878f3249f..00000000000
--- a/addons/crm/wizard/wizard_crm_new_send_email.py
+++ /dev/null
@@ -1,135 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
-# $Id$
-#
-# 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 .
-#
-##############################################################################
-
-from mx.DateTime import now
-
-import wizard
-import netsvc
-import ir
-import pooler
-import tools
-import base64
-from tools.translate import _
-
-
-email_send_form = '''
-'''
-
-email_send_fields = {
- 'to': {'string':"To", 'type':'char', 'size':64, 'required':True},
- 'cc': {'string':"CC", 'type':'char', 'size':128,},
- 'subject': {'string':'Subject', 'type':'char', 'size':128, 'required':True},
- 'text': {'string':'Message', 'type':'text_tag', 'required':True},
- 'state':{'string':'State', 'type':'selection', 'selection':[('done','Done'),('pending','Pending'),('unchanged','Unchanged')]},
- 'doc1' : {'string':"Attachment1", 'type':'binary'},
- 'doc2' : {'string':"Attachment2", 'type':'binary'},
- 'doc3' : {'string':"Attachment3", 'type':'binary'},
- 'state' : {'string':"Set State to", 'type':'selection', 'required' : True, 'default' :'done',\
- 'selection': [('unchanged','Unchanged'),('done','Done'),('pending','Pending')]},
-}
-
-# this sends an email to ALL the addresses of the selected partners.
-def _mass_mail_send(self, cr, uid, data, context):
- attach = filter(lambda x: x, [data['form']['doc1'], data['form']['doc2'], data['form']['doc3']])
- attach = map(lambda x: x and ('Attachment'+str(attach.index(x)+1), base64.decodestring(x)), attach)
-
- pool = pooler.get_pool(cr.dbname)
- case_pool=pool.get(data.get('model'))
-
- case = case_pool.browse(cr,uid,data['ids'])[0]
- emails = [data['form']['to']] + (data['form']['cc'] or '').split(',')
- emails = filter(None, emails)
- body = data['form']['text']
- if case.user_id.signature:
- body += '\n\n%s' % (case.user_id.signature)
- case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['form']['to'], details=body)
- flag = tools.email_send(
- case.user_id.address_id.email,
- emails,
- data['form']['subject'],
- case_pool.format_body(body),
- attach=attach,
- reply_to=case.section_id.reply_to,
- openobject_id=str(case.id),
- subtype="html"
- )
- if flag:
- if data['form']['state'] == 'unchanged':
- pass
- elif data['form']['state'] == 'done':
- case_pool.case_close(cr, uid, data['ids'])
- elif data['form']['state'] == 'pending':
- case_pool.case_pending(cr, uid, data['ids'])
- cr.commit()
- raise wizard.except_wizard(_('Email!'),("Email Successfully Sent"))
- else:
- raise wizard.except_wizard(_('Warning!'),_("Email not sent !"))
- return {}
-
-def _get_info(self, cr, uid, data, context):
- if not data['id']:
- return {}
-
- pool = pooler.get_pool(cr.dbname)
- case = pool.get(data.get('model')).browse(cr, uid, data['id'])
- if not case.user_id:
- raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!'))
- if not case.user_id.address_id.email:
- raise wizard.except_wizard(_('Warning!'),_("Please specify user's email address !"))
-
- return {
- 'to': case.email_from,
- 'subject': case.name,
- 'cc': case.email_cc or ''
- }
-
-class wizard_send_mail(wizard.interface):
- states = {
- 'init': {
- 'actions': [_get_info],
- 'result': {'type': 'form', 'arch': email_send_form, 'fields': email_send_fields, 'state':[('end','Cancel','gtk-cancel'), ('send','Send Email','gtk-go-forward')]}
- },
- 'send': {
- 'actions': [_mass_mail_send],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wizard_send_mail('crm.new.send.mail')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/crm/wizard/wizard_crm_send_email.py b/addons/crm/wizard/wizard_crm_send_email.py
deleted file mode 100644
index d6b3732d5e7..00000000000
--- a/addons/crm/wizard/wizard_crm_send_email.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
-# $Id$
-#
-# 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 .
-#
-##############################################################################
-
-from mx.DateTime import now
-
-import wizard
-import netsvc
-import ir
-import pooler
-import tools
-from tools.translate import _
-
-
-email_send_form = '''
-'''
-
-email_send_fields = {
- 'to': {'string':"To", 'type':'char', 'size':64, 'required':True},
- 'cc': {'string':"CC", 'type':'char', 'size':128,},
- 'subject': {'string':'Subject', 'type':'char', 'size':128, 'required':True},
- 'text': {'string':'Message', 'type':'text_tag', 'required':True}
-}
-
-# this sends an email to ALL the addresses of the selected partners.
-def _mass_mail_send(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
-
- hist_obj = pool.get('crm.case.history').browse(cr,uid,data['ids'])[0]
- model = hist_obj.log_id.model_id.model
- model_pool = pool.get(model)
- case = model_pool.browse(cr, uid, hist_obj.log_id.res_id)
- model_pool._history(cr, uid, [case], _('Send'), history=True, email=False)
- model_pool.write(cr, uid, [case.id], {
- 'som': False,
- 'canal_id': False,
- })
- emails = [data['form']['to']] + (data['form']['cc'] or '').split(',')
- emails = filter(None, emails)
- body = data['form']['text']
- if case.user_id.signature:
- body += '\n\n%s' % (case.user_id.signature)
- tools.email_send(
- case.user_id.address_id.email,
- emails,
- data['form']['subject'],
- model_pool.format_body(body),
- reply_to=case.section_id.reply_to,
- openobject_id=str(case.id),
- subtype="html"
- )
- return {}
-
-def _get_info(self, cr, uid, data, context):
- if not data['id']:
- raise wizard.except_wizard(_('Error'),_('There is no mail to reply!'))
- pool = pooler.get_pool(cr.dbname)
- hist_obj = pool.get('crm.case.history').browse(cr,uid,data['ids'])[0]
- model = hist_obj.log_id.model_id.model
- model_pool = pool.get(model)
- case = model_pool.browse(cr, uid, hist_obj.log_id.res_id)
- if not case.email_from:
- raise wizard.except_wizard(_('Error'),_('You must put a Partner eMail to use this action!'))
- if not case.user_id:
- raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!'))
- return {'to': case.email_from,'subject': '['+str(case.id)+'] '+case.name,'cc': case.email_cc or '', 'text': '> ' + hist_obj.description.replace('\n','\n> ')}
-
-class wizard_send_mail(wizard.interface):
- states = {
- 'init': {
- 'actions': [_get_info],
- 'result': {'type': 'form', 'arch': email_send_form, 'fields': email_send_fields, 'state':[('end','Cancel','gtk-cancel'), ('send','Send Email','gtk-go-forward')]}
- },
- 'send': {
- 'actions': [_mass_mail_send],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wizard_send_mail('crm.send.mail')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_recruitment/hr_hr_view.xml b/addons/hr_recruitment/hr_hr_view.xml
index c86de0f9737..8e6cb840fb0 100644
--- a/addons/hr_recruitment/hr_hr_view.xml
+++ b/addons/hr_recruitment/hr_hr_view.xml
@@ -156,7 +156,11 @@
-
+
@@ -164,8 +168,11 @@
-
-
+
+
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 57c1bf4fa43..41a99f29afe 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -109,7 +109,11 @@
-
+
@@ -117,7 +121,10 @@
-
+