From 85e8e01fd60fd6fd974edab471752c489aa56ab9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 13 Dec 2011 18:48:24 +0530 Subject: [PATCH] notification email for recurring invoice --- .../accounts/doctype/gl_control/gl_control.py | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py index 01f31eb7dd..bab86267c1 100644 --- a/erpnext/accounts/doctype/gl_control/gl_control.py +++ b/erpnext/accounts/doctype/gl_control/gl_control.py @@ -515,6 +515,7 @@ def manage_recurring_invoices(): send_notification(new_rv) + def create_new_invoice(prev_rv): # clone rv new_rv = clone(prev_rv) @@ -533,6 +534,61 @@ def create_new_invoice(prev_rv): return new_rv + def send_notification(new_rv): """Notify concerned persons about recurring invoice generation""" - pass + subject = "Invoice : " + new_rv.doc.name + + com = new_rv.doc.company # get_value('Control Panel', '', 'letter_head') + + hd = '''

%s

+

Invoice: %s

+ + + + + +
Customer
%s
%s
Invoice Date: %s
Due Date: %s
+ ''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, new_rv.doc.posting_date, new_rv.doc.due_date) + + + tbl = ''' + + + + + + + + ''' + for d in getlist(new_rv.doclist, 'entries'): + tbl += '' + tbl += '
ItemDescriptionQtyRateAmount
' + d.item_code +'' + d.description+'' + cstr(d.qty) +'' + cstr(d.basic_rate) +'' + cstr(d.amount) +'
' + + totals =''' + + + + + + +
+ + + + + + + + + + +
Net Total: %s
Total Tax: %s
Grand Total: %s
In Words: %s
+
Terms:
%s
+ ''' % (new_rv.doc.net_total, new_rv.doc.total_tax,new_rv.doc.grand_total, new_rv.doc.in_words,new_rv.doc.terms) + + + msg = hd + tbl + totals + from webnotes.utils.email_lib import sendmail + sendmail(recipients = [new_rv.doc.email_notification_address], \ + sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])