</notebook>
</form>
</field>
- <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="Add New 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': 'crm.lead'}"
icon="terp-mail-message-new" type="action" />
<button string="Forward"
name="%(crm_lead_forward_to_partner_act)d"
</notebook>
</form>
</field>
- <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="Add New 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': 'crm.lead'}"
icon="terp-mail-message-new" type="action" />
<button string="Forward"
name="%(crm_lead_forward_to_partner_act)d"
</notebook>
</form>
</field>
+ <button string="Add New 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': 'crm.case.custom'}"
icon="terp-mail-message-new" type="action" />
- <button string="Add New Note"
- name="%(crm.action_crm_add_note)d"
- context="{'model': 'crm.lead' }"
- icon="terp-mail-message-new" type="action" />
<button string="Forward to Partner"
name="%(crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action" />
#
##############################################################################
-import crm_add_note
import crm_send_email
import crm_forward_to_partner
+import crm_add_note
import crm_lead_to_partner
import crm_lead_to_opportunity
from crm import crm
from osv import fields, osv
from tools.translate import _
-
+import base64
AVAILABLE_STATES = crm.AVAILABLE_STATES + [('unchanged', 'Unchanged')]
_columns = {
'body': fields.text('Note Body', required=True),
'state': fields.selection(AVAILABLE_STATES, string='Set New State To',
- required=True),
+ required=True),
+ 'attachment_ids' : fields.one2many('crm.send.mail.attachment', 'wizard_id'),
}
def action_add(self, cr, uid, ids, context=None):
case = case_list[0]
user_obj = self.pool.get('res.users')
user_name = user_obj.browse(cr, uid, [uid], context=context)[0].name
- case_pool.history(cr, uid, [case], _("Note"), history=True,
- details=obj.body, email_from=user_name)
+ attach = [
+ (x.name, base64.decodestring(x.binary)) for x in obj.attachment_ids
+ ]
+ case_pool.history(cr, uid, [case], _("Note"), history=False,
+ details=obj.body, email_from=user_name, attach=attach)
if obj.state == 'unchanged':
pass
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Add Note" col="4">
- <field name="body" nolabel="1" colspan="4" default_focus="1"/>
+ <separator string="Add Note" colspan="6"/>
+ <notebook colspan="6">
+ <page string="Note">
+ <field name="body" nolabel="1" colspan="4" default_focus="1"/>
+ </page>
+ <page string="Attachments">
+ <field name="attachment_ids" colspan="4" nolabel="1">
+ <form string="Attachment">
+ <field name="binary" filename="name" />
+ <field name="name" />
+ </form>
+ <tree string="Attachments">
+ <field name="name" />
+ </tree>
+ </field>
+ </page>
+ </notebook>
<separator string="" colspan="6"/>
<group colspan="6" col="4" >
<field name="state" />
<button string="_Cancel" icon="gtk-cancel" special="cancel" />
- <button name="action_add" type="object" string="_Add" icon="gtk-go-forward" />
+ <button name="action_add" type="object" string="_Add" icon="gtk-ok" />
</group>
</form>
</field>
</notebook>
</form>
</field>
- <button colspan="4" 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="Add New 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': 'crm.claim'}"
+ icon="terp-mail-message-new" type="action" />
</page>
<page string="Extra Info" groups="base.group_extended">
<field name="id" select="1"/>
</notebook>
</form>
</field>
- <button colspan="4" string="Send New Email"
+ <button string="Add New 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': 'crm.fundraising'}"
icon="terp-mail-message-new" type="action" />
</notebook>
</form>
</field>
- <button colspan="4" string="Send New Email"
+ <button string="Add New 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': 'crm.helpdesk'}"
icon="terp-mail-message-new" type="action" />
</notebook>
</form>
</field>
- <button colspan="4" string="Send New Email"
+ <button string="Add New 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" />
</notebook>
</form>
</field>
- <button colspan="2" string="Send New Email"
+ <button string="Add New 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 colspan="2" string="Forward"
+ <button string="Forward"
name="%(crm.crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action" />
</page>
obj = self.pool.get('mailgate.message')
for case in cases:
+ attachments = []
+ for att in attach:
+ attachments.append(att_obj.create(cr, uid, {'name': att[0], 'datas': base64.encodestring(att[1])}))
+
data = {
'name': keyword,
'user_id': uid,
'model' : case._name,
'res_id': case.id,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
- 'message_id': message_id,
+ 'message_id': message_id,
+ 'description': details or (hasattr(case, 'description') and case.description or False),
+ 'attachment_ids': [(6, 0, attachments)]
}
- attachments = []
- if history:
- for att in attach:
- attachments.append(att_obj.create(cr, uid, {'name': att[0], 'datas': base64.encodestring(att[1])}))
+ if history:
for param in (email, email_cc, email_bcc):
if isinstance(param, list):
param = ", ".join(param)
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
if message.name == _('Opportunity'):
msg_txt += _("Converted to Opportunity")
+ elif message.name == _('Note'):
+ msg_txt += _("Added Note: ") + (message.description or '')
else:
msg_txt += _("Changed Status to: ") + message.name
result[message.id] = msg_txt
</form>
</field>
<separator colspan="4"/>
- <button colspan="4" string="Send New Email"
+ <button string="Add New 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': 'project.issue'}"
icon="terp-mail-message-new" type="action" />