Skip to Content
Menu
This question has been flagged
1 Reply
5335 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

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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

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.

Related Posts Replies Views Activity
2
Oct 23
1512
0
Oct 21
1718
0
Aug 15
2906
3
Jun 15
7831
1
Mar 15
8641