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

I am using odoo 8. I want to send auto mail (without popping up any window) after "Confirm Order" button pressed in saved Request for Quotation(RfQ).

I have created new module which extends 'purchase.order'

class purchase_confirm(osv.osv):

_inherit = 'purchase.order'


def wkf_confirm_order(self, cr, uid, ids, context=None):

ctx = dict(context)

ctx.update({

'lang': 'en_US',

'tz': 'Asia/Dhaka',

'uid': uid,

'send_rfq': False,

'default_model': 'purchase.order',

'active_model': 'purchase.order',

'default_res_id': ids[0],

'default_use_template': bool(template_id),

'default_template_id': template_id,

'default_composition_mode': 'comment',

})

self.pool.get('mail_compose_message').send_mail(cr, uid, ids, context=ctx)

return True

But it is showing following error when I press the "Confirm Order" button:

ValueError: "'NoneType' object has no attribute 'send_mail'" while evaluating

u'wkf_confirm_order()'

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

Most of the time we need to send an email after successfully completion of some tasks or event. To day I will show you how to send an email in odoo using button click.

To send an email in odoo first of all we need create email template. We can create this email template using following two ways.

  1. By using odoo Template Menu Interface

  2. By using xml (code)

You can check more details about how to send email on button click:

http://learnopenerp.blogspot.com/2017/08/odoo-how-to-send-email-on-button-click.html


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 4 19
8849
1
thg 5 16
8223
3
thg 5 16
6119
1
thg 10 24
8832
2
thg 5 25
10087