From 1d5310166d72ca4b05609e64b13b9def3e13403a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 7 Feb 2019 18:18:01 +0530 Subject: [PATCH] fix: Set default print language in Notification --- frappe/email/doctype/notification/notification.py | 11 +++++++++-- frappe/email/queue.py | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frappe/email/doctype/notification/notification.py b/frappe/email/doctype/notification/notification.py index a3f43f716d..acddf36777 100644 --- a/frappe/email/doctype/notification/notification.py +++ b/frappe/email/doctype/notification/notification.py @@ -212,8 +212,15 @@ def get_context(context): please enable Allow Print For {0} in Print Settings""".format(status)), title=_("Error in Notification")) else: - return [{"print_format_attachment":1, "doctype":doc.doctype, "name": doc.name, - "print_format":self.print_format, "print_letterhead": print_settings.with_letterhead}] + return [{ + "print_format_attachment": 1, + "doctype": doc.doctype, + "name": doc.name, + "print_format": self.print_format, + "print_letterhead": print_settings.with_letterhead, + "lang": frappe.db.get_value('Print Format', self.print_format, 'default_print_language') + if self.print_format else 'en' + }] def get_template(self): diff --git a/frappe/email/queue.py b/frappe/email/queue.py index 0ed4044586..e62e7ca674 100755 --- a/frappe/email/queue.py +++ b/frappe/email/queue.py @@ -175,7 +175,8 @@ def get_email_queue(recipients, sender, subject, **kwargs): if att.get('fid'): _attachments.append(att) elif att.get("print_format_attachment") == 1: - att['lang'] = frappe.local.lang + if not att.get('lang', None): + att['lang'] = frappe.local.lang att['print_letterhead'] = kwargs.get('print_letterhead') _attachments.append(att) e.attachments = json.dumps(_attachments)