Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Project Issue - Subject

By
Dave Ellison
on 1/2/14, 12:19 PM 2,068 views

Hi,

On sending emails to customers, the subject is from the name field. Is there any way to concatenate the record ID+name? On emails being sent we are looking for the format:

'id'+' - '+'subject'

Ok, based on the below comment, I have this method. My Python is not advanced enough to know what I should do with this method after overriding or even if I were to adjust this to test.

    def get_record_data(self, cr, uid, model, res_id, context=None):
    """ Returns a defaults-like dict with initial values for the composition
        wizard when sending an email related to the document record
        identified by ``model`` and ``res_id``.

        :param str model: model name of the document record this mail is
            related to.
        :param int res_id: id of the document record this mail is related to
    """
    doc_name_get = self.pool.get(model).name_get(cr, uid, [res_id], context=context)
    record_name = False
    if doc_name_get:
        record_name = doc_name_get[0][1]
    values = {
        'model': model,
        'res_id': res_id,
        'record_name': record_name,
    }
    if record_name:
        values['subject'] = 'Re: %s' % record_name
    return values

Thanks

1
Pinakin Nayi (pna)
On 1/3/14, 3:10 AM

Hi,

You can do this by two ways, either in particular model define def name_get method and append string whatever you want.

Or You can override mail.compose.message model and override def get_record_data method and change record_name.

Thanks...

Hi,thanks for the response. I am not seeing this method in project_issue.py. Am I looking in the wrong place?

Dave Ellison
on 1/3/14, 6:12 AM

Hi, you need to override that method, means if you want to do it by mail.compose.message just inherit mail.compose.message and override def get_record_data method and customize it.

Pinakin Nayi (pna)
on 1/3/14, 8:09 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 1/2/14, 12:19 PM
Seen: 2068 times
Last updated: 3/16/15, 8:10 AM