Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3827 Ansichten

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Jan. 20
4952
1
Sept. 16
4522
0
Sept. 15
3667
0
Juli 15
4152
2
Mai 15
3613