[IMP] email.compose.message: removed method _get_records() and on_change_referred_doc()

bzr revid: rha@tinyerp.com-20110407134220-w54lyxvcy7dzvemg
This commit is contained in:
Rifakat Haradwala (Open ERP) 2011-04-07 19:12:20 +05:30
parent 05f807aff0
commit fa0aa7f2ad
4 changed files with 5 additions and 56 deletions

View File

@ -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:

View File

@ -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>

View File

@ -98,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):
@ -173,27 +148,6 @@ 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 send_mail(self, cr, uid, ids, context=None):
if context is None:
context = {}

View File

@ -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"/>