Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5518 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 23
1669
0
thg 10 21
1896
0
thg 8 15
3059
3
thg 6 15
8031
1
thg 3 15
8800