Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3732 Widoki

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?

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sty 20
4882
1
wrz 16
4485
0
wrz 15
3619
0
lip 15
4103
2
maj 15
3532