[IMP]: crm*: Improvements for "Add note" wizard,

* Added field for attachment to add attachment in Notes
* Put proper icon
* Improvement in Display text when we add a new Note
* Added button for this wizard in all crm related modules

bzr revid: rpa@tinyerp.com-20100907132140-9a9y8sigcktvdqk3
This commit is contained in:
rpa (Open ERP) 2010-09-07 18:51:40 +05:30
parent 8d7fc2739b
commit f0282a8c72
13 changed files with 83 additions and 34 deletions

View File

@ -211,13 +211,13 @@
</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"

View File

@ -168,13 +168,13 @@
</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"

View File

@ -568,14 +568,14 @@
</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" />

View File

@ -19,9 +19,9 @@
#
##############################################################################
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

View File

@ -1,7 +1,7 @@
from crm import crm
from osv import fields, osv
from tools.translate import _
import base64
AVAILABLE_STATES = crm.AVAILABLE_STATES + [('unchanged', 'Unchanged')]
@ -14,7 +14,8 @@ class crm_add_note(osv.osv_memory):
_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):
@ -33,8 +34,11 @@ class crm_add_note(osv.osv_memory):
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

View File

@ -10,12 +10,28 @@
<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>

View File

@ -205,10 +205,14 @@
</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"/>

View File

@ -197,7 +197,11 @@
</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" />

View File

@ -134,7 +134,11 @@
</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" />

View File

@ -409,7 +409,11 @@
</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" />

View File

@ -186,11 +186,15 @@
</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>

View File

@ -122,19 +122,22 @@ class mailgate_thread(osv.osv):
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)
@ -187,6 +190,8 @@ class mailgate_message(osv.osv):
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

View File

@ -117,7 +117,11 @@
</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" />