Merge branch 'master' into staging

This commit is contained in:
mbauskar 2017-08-14 12:33:56 +05:30
commit 40377e87de
3 changed files with 21 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import inspect
import frappe import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
__version__ = '8.8.2' __version__ = '8.8.3'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -11,6 +11,7 @@ from erpnext.accounts.party import get_party_account
from erpnext.accounts.utils import get_account_currency from erpnext.accounts.utils import get_account_currency
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry, get_company_defaults from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry, get_company_defaults
from frappe.integrations.utils import get_payment_gateway_controller from frappe.integrations.utils import get_payment_gateway_controller
from frappe.utils.background_jobs import enqueue
class PaymentRequest(Document): class PaymentRequest(Document):
def validate(self): def validate(self):
@ -143,9 +144,15 @@ class PaymentRequest(Document):
def send_email(self): def send_email(self):
"""send email with payment link""" """send email with payment link"""
frappe.sendmail(recipients=self.email_to, sender=None, subject=self.subject, email_args = {
message=self.get_message(), attachments=[frappe.attach_print(self.reference_doctype, "recipients": self.email_to,
self.reference_name, file_name=self.reference_name, print_format=self.print_format)]) "sender": None,
"subject": self.subject,
"message": self.get_message(),
"now": True,
"attachments": [frappe.attach_print(self.reference_doctype, self.reference_name,
file_name=self.reference_name, print_format=self.print_format)]}
enqueue(method=frappe.sendmail, queue='short', timeout=300, async=True, **email_args)
def get_message(self): def get_message(self):
"""return message with payment gateway link""" """return message with payment gateway link"""

View File

@ -11,6 +11,7 @@ from frappe import msgprint, _
from erpnext.hr.doctype.process_payroll.process_payroll import get_start_end_dates from erpnext.hr.doctype.process_payroll.process_payroll import get_start_end_dates
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
from erpnext.utilities.transaction_base import TransactionBase from erpnext.utilities.transaction_base import TransactionBase
from frappe.utils.background_jobs import enqueue
class SalarySlip(TransactionBase): class SalarySlip(TransactionBase):
def autoname(self): def autoname(self):
@ -396,9 +397,15 @@ class SalarySlip(TransactionBase):
receiver = frappe.db.get_value("Employee", self.employee, "prefered_email") receiver = frappe.db.get_value("Employee", self.employee, "prefered_email")
if receiver: if receiver:
subj = 'Salary Slip - from {0} to {1}'.format(self.start_date, self.end_date) email_args = {
frappe.sendmail([receiver], subject=subj, message = _("Please see attachment"), "recipients": [receiver],
attachments=[frappe.attach_print(self.doctype, self.name, file_name=self.name)], reference_doctype= self.doctype, reference_name= self.name) "message": _("Please see attachment"),
"subject": 'Salary Slip - from {0} to {1}'.format(self.start_date, self.end_date),
"attachments": [frappe.attach_print(self.doctype, self.name, file_name=self.name)],
"reference_doctype": self.doctype,
"reference_name": self.name
}
enqueue(method=frappe.sendmail, queue='short', timeout=300, async=True, **email_args)
else: else:
msgprint(_("{0}: Employee email not found, hence email not sent").format(self.employee_name)) msgprint(_("{0}: Employee email not found, hence email not sent").format(self.employee_name))