mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
fix: Skip Update Password in Preview
- dont show update password button in preview, its for the suppliers mail only - modified docstrings - update supplier row contact only if None
This commit is contained in:
@@ -247,8 +247,8 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.fields_dict.note.$wrapper.append(`<p class="small text-muted">This is a preview of the email to be sent. A PDF of this document will
|
dialog.fields_dict.note.$wrapper.append(`<p class="small text-muted">This is a preview of the email to be sent. A PDF of the document will
|
||||||
automatically be attached with the mail.</p>`);
|
automatically be attached with the email.</p>`);
|
||||||
|
|
||||||
dialog.set_value("subject", frm.doc.subject);
|
dialog.set_value("subject", frm.doc.subject);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|||||||
@@ -63,25 +63,18 @@ class RequestforQuotation(BuyingController):
|
|||||||
frappe.db.set(self, 'status', 'Cancelled')
|
frappe.db.set(self, 'status', 'Cancelled')
|
||||||
|
|
||||||
def get_supplier_email_preview(self, supplier):
|
def get_supplier_email_preview(self, supplier):
|
||||||
'''Returns formatted email preview as string'''
|
"""Returns formatted email preview as string"""
|
||||||
rfq_suppliers = list(filter(lambda row: row.supplier == supplier, self.suppliers))
|
rfq_suppliers = list(filter(lambda row: row.supplier == supplier, self.suppliers))
|
||||||
rfq_supplier = rfq_suppliers[0]
|
rfq_supplier = rfq_suppliers[0]
|
||||||
|
|
||||||
self.validate_email_id(rfq_supplier)
|
self.validate_email_id(rfq_supplier)
|
||||||
|
|
||||||
update_password_link = ""
|
message = self.supplier_rfq_mail(rfq_supplier, '', self.get_link(), True)
|
||||||
if not frappe.db.exists("User", rfq_supplier.email_id):
|
|
||||||
# user doesnt exist
|
|
||||||
# so (dummy) update password button, should be included for preview
|
|
||||||
# as it will be included in actual mail, on user creation
|
|
||||||
update_password_link = "#"
|
|
||||||
|
|
||||||
message = self.supplier_rfq_mail(rfq_supplier, update_password_link, self.get_link(), True)
|
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
||||||
def send_to_supplier(self):
|
def send_to_supplier(self):
|
||||||
'''Sends RFQ mail to involved suppliers'''
|
"""Sends RFQ mail to involved suppliers"""
|
||||||
for rfq_supplier in self.suppliers:
|
for rfq_supplier in self.suppliers:
|
||||||
if rfq_supplier.send_email:
|
if rfq_supplier.send_email:
|
||||||
self.validate_email_id(rfq_supplier)
|
self.validate_email_id(rfq_supplier)
|
||||||
@@ -92,7 +85,8 @@ class RequestforQuotation(BuyingController):
|
|||||||
self.update_supplier_part_no(rfq_supplier)
|
self.update_supplier_part_no(rfq_supplier)
|
||||||
self.supplier_rfq_mail(rfq_supplier, update_password_link, self.get_link())
|
self.supplier_rfq_mail(rfq_supplier, update_password_link, self.get_link())
|
||||||
rfq_supplier.email_sent = 1
|
rfq_supplier.email_sent = 1
|
||||||
rfq_supplier.contact = contact
|
if not rfq_supplier.contact:
|
||||||
|
rfq_supplier.contact = contact
|
||||||
rfq_supplier.save()
|
rfq_supplier.save()
|
||||||
|
|
||||||
def get_link(self):
|
def get_link(self):
|
||||||
@@ -119,10 +113,7 @@ class RequestforQuotation(BuyingController):
|
|||||||
return update_password_link, contact
|
return update_password_link, contact
|
||||||
|
|
||||||
def link_supplier_contact(self, rfq_supplier, user):
|
def link_supplier_contact(self, rfq_supplier, user):
|
||||||
'''
|
"""If no Contact, create a new contact against Supplier. If Contact exists, check if email and user id set"""
|
||||||
Create a new contact if no contact against Supplier.
|
|
||||||
If Contact exists, check if email and user id set
|
|
||||||
'''
|
|
||||||
if rfq_supplier.contact:
|
if rfq_supplier.contact:
|
||||||
contact = frappe.get_doc("Contact", rfq_supplier.contact)
|
contact = frappe.get_doc("Contact", rfq_supplier.contact)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user