[IMP] outlook function prototype for plugin
bzr revid: al@openerp.com-20111122112525-wf86e3q6tgb2mgas
This commit is contained in:
parent
c8acea4be4
commit
2503908223
|
@ -68,6 +68,7 @@ class plugin_handler(osv.osv_memory):
|
|||
doc_dict['res.partner'] = "Partner"
|
||||
return doc_dict.items()
|
||||
|
||||
# Can be used where search record was used
|
||||
def list_document_get(self, cr, uid, model, name):
|
||||
"""
|
||||
This function return the result of name_search on the object model
|
||||
|
@ -109,7 +110,6 @@ class plugin_handler(osv.osv_memory):
|
|||
url = self._make_url(cr, uid, res_id, model)
|
||||
return (model, res_id, url, notify)
|
||||
|
||||
|
||||
def contact_create(self, cr, uid, data, partner_id):
|
||||
"""
|
||||
@param data : the data use to create the res.partner.address
|
||||
|
@ -127,24 +127,25 @@ class plugin_handler(osv.osv_memory):
|
|||
url = self._make_url(cr, uid, partner_id, 'res.partner')
|
||||
return ('res.partner', partner_id, url)
|
||||
|
||||
# Specific to outlook rfc822 is not available so we split in arguments headerd,body,attachemnts
|
||||
def push_message_outlook(self, cr, uid, model, headers, body_text, body_html, attachments):
|
||||
pass
|
||||
# ----------------------------------------
|
||||
# solution 1
|
||||
# construct a fake rfc822 from the separated arguement
|
||||
#m = email.asdfsadf
|
||||
# use the push_message method
|
||||
#self.push_message(m)
|
||||
# ----------------------------------------
|
||||
# solution 2
|
||||
# use self.pushmessage only with header and body
|
||||
# add attachemnt yourself after
|
||||
|
||||
|
||||
##############################
|
||||
# #
|
||||
# Specific to outlook #
|
||||
# #
|
||||
##############################
|
||||
|
||||
def attachment_create(self,cr, uid, data):
|
||||
"""
|
||||
@param data : the data use to create the ir.attachment
|
||||
[('field_name', value)], field name is required.
|
||||
"""
|
||||
ir_attachment_obj = self.pool.get('ir.attachment')
|
||||
attachment_ids = ir_attachment_obj.search(cr, uid, [('res_model', '=', data.get('res_model')), ('res_id', '=', data.get('res_id')), ('datas_fname', '=', data.get('datas_fname'))])
|
||||
if attachment_ids:
|
||||
return attachment_ids[0]
|
||||
else:
|
||||
vals = {"res_model": data.get('res_model'), "res_id": data.get('res_id'), "name": data.get('name'), "datas" : data.get('datas'), "datas_fname" : data.get('datas_fname')}
|
||||
return ir_attachment_obj.create(cr, uid, vals)
|
||||
|
||||
#ir_attachment_obj = self.pool.get('ir.attachment')
|
||||
#attachment_ids = ir_attachment_obj.search(cr, uid, [('res_model', '=', data.get('res_model')), ('res_id', '=', data.get('res_id')), ('datas_fname', '=', data.get('datas_fname'))])
|
||||
#if attachment_ids:
|
||||
# return attachment_ids[0]
|
||||
#else:
|
||||
# vals = {"res_model": data.get('res_model'), "res_id": data.get('res_id'), "name": data.get('name'), "datas" : data.get('datas'), "datas_fname" : data.get('datas_fname')}
|
||||
# return ir_attachment_obj.create(cr, uid, vals)
|
||||
#return (model, res_id, url, notify)
|
||||
|
|
Loading…
Reference in New Issue