Merge pull request #2498 from anandpdoshi/anand-dec-15

[minor] use frappe.attach_print() in salary slip and recurring document
This commit is contained in:
Anand Doshi 2014-12-16 12:42:40 +05:30
commit cd7a1661c6
2 changed files with 2 additions and 8 deletions

View File

@ -124,10 +124,7 @@ def send_notification(new_rv):
frappe.sendmail(new_rv.notification_email_address, frappe.sendmail(new_rv.notification_email_address,
subject= _("New {0}: #{1}").format(new_rv.doctype, new_rv.name), subject= _("New {0}: #{1}").format(new_rv.doctype, new_rv.name),
message = _("Please find attached {0} #{1}").format(new_rv.doctype, new_rv.name), message = _("Please find attached {0} #{1}").format(new_rv.doctype, new_rv.name),
attachments = [{ attachments = [frappe.attach_print(new_rv.doctype, new_rv.name, file_name=new_rv.name)])
"fname": new_rv.name + ".pdf",
"fcontent": frappe.get_print_format(new_rv.doctype, new_rv.name, as_pdf=True)
}])
def notify_errors(doc, doctype, party, owner): def notify_errors(doc, doctype, party, owner):
from frappe.utils.user import get_system_managers from frappe.utils.user import get_system_managers

View File

@ -191,9 +191,6 @@ class SalarySlip(TransactionBase):
if receiver: if receiver:
subj = 'Salary Slip - ' + cstr(self.month) +'/'+cstr(self.fiscal_year) subj = 'Salary Slip - ' + cstr(self.month) +'/'+cstr(self.fiscal_year)
sendmail([receiver], subject=subj, msg = _("Please see attachment"), sendmail([receiver], subject=subj, msg = _("Please see attachment"),
attachments=[{ attachments=[frappe.attach_print(self.doctype, self.name, file_name=self.name)])
"fname": self.name + ".pdf",
"fcontent": frappe.get_print_format(self.doctype, self.name, as_pdf = True)
}])
else: else:
msgprint(_("Company Email ID not found, hence mail not sent")) msgprint(_("Company Email ID not found, hence mail not sent"))