İçereği Atla
Menü
Bu soru işaretlendi
3721 Görünümler

I wish to add email notification when a 'quotation' changes state.

Key actions I want to record and email out are:
Quote Accepted,
Quote Rejected,
Feedback Submitted.

What would be the best practice to add this capability to the existing workflows (sale.order.basic)?

My current attempt has this code in another module which works to a point...

def action_wait(self, cr, uid, ids, context=None):
context = context or {}
context = context or {}
for o in self.browse(cr, uid, ids):
if not any(line.state != 'cancel' for line in o.order_line):
raise osv.except_osv(_('Error!'),_('You cannot confirm a sales order which has no line.'))
noprod = self.test_no_product(cr, uid, o, context)
if (o.order_policy == 'manual') or noprod:
self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
else:
self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line if x.state != 'cancel'])
_logger.error("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
email_ids = self.pool.get('mail.mail')
raise_exception=False
message="Sales Order Signed and Confirmed"
vals = {'state': 'outgoing',
'subject': 'Order Confirmation',
'body_html': message,
'body_html': '<pre>%s</pre>' % message,
'email_to': 'example_to@example.com',
'email_from': 'example_from@example.com',
}
msg_id = email_ids.create(cr, uid, vals, context=context)
_logger.error(msg_id)
email_ids.send(cr, uid, [msg_id], raise_exception=raise_exception, context=context)
return True

The problem with this is I can't call variable values like:
Quote number,
Client Email,
Etc.

Is it possible to call such information in a python file or does it have to be accessed via XML templates?

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Oca 20
4877
1
Eyl 16
4478
0
Eyl 15
3611
0
Tem 15
4100
2
May 15
3525