Create a new record on Incoming Mails odoo

1). configure incoming mail server

2).Install Document Management System module

3). create a custom module (.py file)

from openerp.osv import fields,osv
from openerp import models
from openerp import tools
from import _
from import email_re, email_split
from import html2plaintext

class incoming_mail_ep(osv.osv):
 _inherit = ['mail.thread']
 'name': fields.char('Subject', required=True, select=1),
 'partner_name': fields.char("Customer Name", size=64,select=1),
 'email_from': fields.char('Email', size=128,required=True,select=1),
 'email_cc': fields.text('Global CC'),
 'user_id': fields.many2one('res.users', 'Salesperson',required=True),
 'partner_id': fields.many2one('res.partner', 'Partner',required=True,select=True),
 'description': fields.text('Description'),
 def message_new(self, cr, uid, msg, custom_values=None, context=None):
 if custom_values is None:
 custom_values = {}
 defaults = {
 'name': msg.get('subject') or _("No Subject"),
 'email_from': msg.get('from'),
 'description': html2plaintext(msg.get('body')),
 'email_cc': msg.get('cc'),
 'partner_id': msg.get('author_id', False),
 'user_id': False,
 return super(incoming_mail_ep, self).message_new(cr, uid, msg, custom_values=defaults, context=context)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s