Procházet zdrojové kódy

[minor] option in auto email report to send if data

version-14
Rushabh Mehta před 8 roky
rodič
revize
9670bed459
2 změnil soubory, kde provedl 38 přidání a 1 odebrání
  1. +28
    -1
      frappe/email/doctype/auto_email_report/auto_email_report.json
  2. +10
    -0
      frappe/email/doctype/auto_email_report/auto_email_report.py

+ 28
- 1
frappe/email/doctype/auto_email_report/auto_email_report.json Zobrazit soubor

@@ -93,6 +93,33 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "send_if_data",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Send only if there is any data",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@@ -475,7 +502,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-09-22 07:54:01.020149",
"modified": "2016-09-23 01:06:56.963190",
"modified_by": "Administrator",
"module": "Email",
"name": "Auto Email Report",


+ 10
- 0
frappe/email/doctype/auto_email_report/auto_email_report.py Zobrazit soubor

@@ -44,6 +44,9 @@ class AutoEmailReport(Document):
report = frappe.get_doc('Report', self.report)
raw = report.get_data(limit=self.no_of_rows or 100, user = self.user, filters = self.filters)

if len(raw)==1 and self.send_if_data:
return None

if self.format == 'HTML':
return self.get_html_table(raw)

@@ -67,6 +70,9 @@ class AutoEmailReport(Document):

def send(self):
data = self.get_report_content()
if not data:
return

attachments = None
message = '<p>{0}</p>'.format(_('{0} generated on {1}')\
.format(frappe.bold(self.name),
@@ -99,6 +105,10 @@ def download(name):
auto_email_report.check_permission()
data = auto_email_report.get_report_content()

if not data:
frappe.msgprint(_('No Data'))
return

frappe.local.response.filecontent = data
frappe.local.response.type = "download"
frappe.local.response.filename = auto_email_report.get_file_name()


Načítá se…
Zrušit
Uložit