Merge pull request #6896 from netchampfaris/default-print-lang-notification

fix: Set default print language in Notification
This commit is contained in:
Rushabh Mehta 2019-02-07 20:26:33 +05:30 committed by GitHub
commit ef23c57106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -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):

View file

@ -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)