[FIX] crm: made common view of reply mail and send new mail wizard
bzr revid: hmo@tinyerp.com-20100330144913-2oy0fk8o3ii1txzl
This commit is contained in:
parent
5f80bdb7e6
commit
d491630233
|
@ -157,7 +157,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_reply_mail)d"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.claim'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_reply_mail)d"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.fundraising'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_reply_mail)d"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_reply_mail)d"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_reply_mail)d"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.opportunity'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
|
@ -347,7 +347,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_reply_mail)d"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.case'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
|
@ -328,6 +328,10 @@ class email_parser(object):
|
|||
def msg_test(self, msg, case_str):
|
||||
if not case_str:
|
||||
return (False, False)
|
||||
res = self.rpc(self.model, 'search', [('id', '=', int(case_str))])
|
||||
if not res:
|
||||
return (False, False)
|
||||
|
||||
emails = self.rpc(self.model, 'emails_get', int(case_str))
|
||||
return (int(case_str), emails)
|
||||
|
||||
|
@ -336,9 +340,9 @@ class email_parser(object):
|
|||
if case_str:
|
||||
case_str = case_str.group(1)
|
||||
else:
|
||||
case_str = case_re.search(msg.get('Subject', ''))
|
||||
case_str = case_re.search(msg.get('Subject', ''))
|
||||
if case_str:
|
||||
case_str = case_str.group(1)
|
||||
case_str = case_str.group(1)
|
||||
(case_id, emails) = self.msg_test(msg, case_str)
|
||||
if case_id:
|
||||
if emails[0] and self.email_get(emails[0])==self.email_get(self._decode_header(msg['From'])):
|
||||
|
|
|
@ -185,7 +185,7 @@ class crm_send_new_email(osv.osv_memory):
|
|||
res.update({'email_to': hist.email_from or (case.user_id and case.user_id.address_id and \
|
||||
case.user_id.address_id.email) or tools.config.get('email_from',False)})
|
||||
if 'email_from' in fields:
|
||||
res.update({'email_from': hist.email_to or (case.user_id and case.user_id.address_id and \
|
||||
res.update({'email_from': (case.user_id and case.user_id.address_id and \
|
||||
case.user_id.address_id.email) or tools.config.get('email_from',False)})
|
||||
if 'text' in fields:
|
||||
header = '-------- Original Message --------'
|
||||
|
@ -198,8 +198,8 @@ class crm_send_new_email(osv.osv_memory):
|
|||
res.update({'text': '\n\n%s'%(original)})
|
||||
if 'subject' in fields:
|
||||
res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')})
|
||||
#if 'state' in fields:
|
||||
# res.update({'state': 'pending'})
|
||||
if 'state' in fields:
|
||||
res.update({'state': 'pending'})
|
||||
return res
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
<!-- Send New Mail view -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_send_new_mail_view">
|
||||
<field name="name">crm.new.send.mail.form</field>
|
||||
<record model="ir.ui.view" id="crm_send_mail_view">
|
||||
<field name="name">crm.send.mail.form</field>
|
||||
<field name="model">crm.send.mail</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Send New Mail" col="2">
|
||||
<form string="Send Mail" col="2">
|
||||
<field name="email_from" />
|
||||
<field name="email_to" />
|
||||
<field name="email_cc" />
|
||||
|
@ -34,52 +34,12 @@
|
|||
<!-- Send New Mail action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_crm_send_mail">
|
||||
<field name="name">Send New Mail</field>
|
||||
<field name="name">Send Mail</field>
|
||||
<field name="res_model">crm.send.mail</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_send_new_mail_view"/>
|
||||
<field name="view_id" ref="crm_send_mail_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Reply to Mail view -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_reply_mail_view">
|
||||
<field name="name">crm.mail.reply.form</field>
|
||||
<field name="model">crm.send.mail</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Reply to last Mail" col="2">
|
||||
<field name="email_from" />
|
||||
<field name="email_to" />
|
||||
<field name="email_cc" />
|
||||
<field name="subject" />
|
||||
<field name="doc1" />
|
||||
<field name="doc2" />
|
||||
<field name="doc3" />
|
||||
<separator string="" colspan="4"/>
|
||||
<field name="text" nolabel="1" colspan="4"/>
|
||||
<separator string=" " colspan="4"/>
|
||||
<group colspan="4" col="3" >
|
||||
<label string=" " />
|
||||
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
|
||||
<button name="action_send" type="object" string="_Send Reply" icon="gtk-go-forward" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Reply to Mail action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_crm_reply_mail">
|
||||
<field name="name">Reply to last Mail</field>
|
||||
<field name="res_model">crm.send.mail</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_reply_mail_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(crm.action_crm_reply_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'hr.applicant'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(crm.action_crm_reply_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'project.issue'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue