fixed auto material request email
This commit is contained in:
parent
2c9103fc05
commit
c64da278ca
@ -1,4 +1,8 @@
|
|||||||
erpnext.updates = [
|
erpnext.updates = [
|
||||||
|
["21st February, 2013", [
|
||||||
|
"Item: Warehouse-wise Re-order Level and Quantity",
|
||||||
|
"Buying: Purchase Request renamed to Material Request"
|
||||||
|
]],
|
||||||
["20th February, 2013", [
|
["20th February, 2013", [
|
||||||
"Disable Rounded Total: If disable in 'Global Defaults', Rounding related fields \
|
"Disable Rounded Total: If disable in 'Global Defaults', Rounding related fields \
|
||||||
in sales cycle transactions and in corresponding print formats will not be visible"
|
in sales cycle transactions and in corresponding print formats will not be visible"
|
||||||
|
@ -18,7 +18,8 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _
|
from webnotes import _
|
||||||
|
|
||||||
from webnotes.utils import add_days, cint, cstr, flt, now, nowdate
|
from webnotes.utils import add_days, cint, cstr, flt, now, nowdate, \
|
||||||
|
get_url_to_form, formatdate
|
||||||
from webnotes.model import db_exists
|
from webnotes.model import db_exists
|
||||||
from webnotes.model.doc import Document, addchild
|
from webnotes.model.doc import Document, addchild
|
||||||
from webnotes.model.bean import copy_doclist
|
from webnotes.model.bean import copy_doclist
|
||||||
@ -151,15 +152,15 @@ class DocType:
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
mr.insert()
|
mr.insert()
|
||||||
mr.submit()
|
|
||||||
|
|
||||||
msgprint("""Item: %s is to be re-ordered. Material Request %s raised.
|
msgprint("""Item: %s is to be re-ordered. Material Request %s raised.
|
||||||
It was generated from %s: %s""" %
|
It was generated from %s: %s""" %
|
||||||
(self.doc.item_code, mr.doc.name, doc_type, doc_name ))
|
(self.doc.item_code, mr.doc.name, doc_type, doc_name))
|
||||||
|
|
||||||
if(item.email_notify):
|
if(item.email_notify):
|
||||||
self.send_email_notification(doc_type, doc_name)
|
self.send_email_notification(doc_type, doc_name, mr)
|
||||||
|
|
||||||
def send_email_notification(self, doc_type, doc_name):
|
def send_email_notification(self, doc_type, doc_name, bean):
|
||||||
""" Notify user about auto creation of indent"""
|
""" Notify user about auto creation of indent"""
|
||||||
|
|
||||||
from webnotes.utils.email_lib import sendmail
|
from webnotes.utils.email_lib import sendmail
|
||||||
@ -167,6 +168,10 @@ class DocType:
|
|||||||
where p.name = r.parent and p.enabled = 1 and p.docstatus < 2
|
where p.name = r.parent and p.enabled = 1 and p.docstatus < 2
|
||||||
and r.role in ('Purchase Manager','Material Manager')
|
and r.role in ('Purchase Manager','Material Manager')
|
||||||
and p.name not in ('Administrator', 'All', 'Guest')""")]
|
and p.name not in ('Administrator', 'All', 'Guest')""")]
|
||||||
msg="""A Material Request has been raised
|
|
||||||
for item %s: %s on %s """ % (doc_type, doc_name, nowdate())
|
msg="""A new Material Request has been raised for Item: %s and Warehouse: %s \
|
||||||
|
on %s due to %s: %s. See %s: %s """ % (self.doc.item_code, self.doc.warehouse,
|
||||||
|
formatdate(), doc_type, doc_name, bean.doc.doctype,
|
||||||
|
get_url_to_form(bean.doc.doctype, bean.doc.name))
|
||||||
|
|
||||||
sendmail(email_list, subject='Auto Material Request Generation Notification', msg = msg)
|
sendmail(email_list, subject='Auto Material Request Generation Notification', msg = msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user