'Called by ``message_process`` when a new message is received
for a given thread model, if the message did not belong to
an existing thread.
The default behavior is to create a new record of the corresponding
model (based on some very basic info extracted from the message).
Additional behavior may be implemented by overriding this method.
:param dict msg_dict: a map containing the email details and
attachments. See ``message_process`` and
``mail.message.parse`` for details.
:param dict custom_values: optional dictionary of additional
field values to pass to create()
when creating the new thread record.
Be careful, these values may override
any other values coming from the message.
:param dict context: if a ``thread_model`` value is present
in the context, its value will be used
to determine the model of the record
to create (instead of the current model).
:rtype: int
:return: the id of the newly created thread object'

@api.model
def message_new(self, msg_dict, custom_values=None):

    data = {}
    if isinstance(custom_values, dict):
        data = custom_values.copy()
    model = (self._context.get('thread_model') or self._name)
    RecordModel = self.env[model]
    fields = RecordModel.fields_get()
    name_field = (RecordModel._rec_name or 'name')
    if ((name_field in fields) and (not data.get('name'))):
        data[name_field] = msg_dict.get('subject', '')
    res = RecordModel.create(data)
    return res.id
