mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-29 22:58:25 +00:00
refactor(email_digest): convert get_digest_msg from module function to instance method (#58193)
(cherry picked from commit 4cd8fbf1c0)
# Conflicts:
# erpnext/setup/doctype/email_digest/email_digest.py
This commit is contained in:
@@ -5,23 +5,33 @@ frappe.ui.form.on("Email Digest", {
|
|||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
if (!frm.is_new()) {
|
if (!frm.is_new()) {
|
||||||
frm.add_custom_button(__("View Now"), function () {
|
frm.add_custom_button(__("View Now"), function () {
|
||||||
frappe.call({
|
if (frm.is_dirty()) {
|
||||||
method: "erpnext.setup.doctype.email_digest.email_digest.get_digest_msg",
|
frappe.show_alert({
|
||||||
args: {
|
message: __("Save the Email Digest first.", "yellow"),
|
||||||
name: frm.doc.name,
|
indicator: "yellow",
|
||||||
},
|
});
|
||||||
callback: function (r) {
|
return;
|
||||||
let d = new frappe.ui.Dialog({
|
}
|
||||||
title: __("Email Digest: {0}", [frm.doc.name]),
|
|
||||||
width: 800,
|
frm.call("get_digest_msg").then((r) => {
|
||||||
});
|
let d = new frappe.ui.Dialog({
|
||||||
$(d.body).html(r.message);
|
title: __("Email Digest: {0}", [frm.doc.name]),
|
||||||
d.show();
|
width: 800,
|
||||||
},
|
});
|
||||||
|
$(d.body).html(r.message);
|
||||||
|
d.show();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.add_custom_button(__("Send Now"), function () {
|
frm.add_custom_button(__("Send Now"), function () {
|
||||||
|
if (frm.is_dirty()) {
|
||||||
|
frappe.show_alert({
|
||||||
|
message: __("Save the Email Digest first.", "yellow"),
|
||||||
|
indicator: "yellow",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return frm.call("send", null, () => {
|
return frm.call("send", null, () => {
|
||||||
frappe.show_alert({ message: __("Message Sent"), indicator: "green" });
|
frappe.show_alert({ message: __("Message Sent"), indicator: "green" });
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -894,6 +894,10 @@ class EmailDigest(Document):
|
|||||||
|
|
||||||
return items_by_parent
|
return items_by_parent
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_digest_msg(self):
|
||||||
|
return self.get_msg_html()
|
||||||
|
|
||||||
|
|
||||||
def send():
|
def send():
|
||||||
now_date = now_datetime().date()
|
now_date = now_datetime().date()
|
||||||
@@ -908,11 +912,14 @@ def send():
|
|||||||
ed_obj.send()
|
ed_obj.send()
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_digest_msg(name):
|
def get_digest_msg(name):
|
||||||
return frappe.get_doc("Email Digest", name).get_msg_html()
|
return frappe.get_doc("Email Digest", name).get_msg_html()
|
||||||
|
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> 4cd8fbf1c0 (refactor(email_digest): convert `get_digest_msg` from module function to instance method (#58193))
|
||||||
def get_incomes_expenses_for_period(account, from_date, to_date):
|
def get_incomes_expenses_for_period(account, from_date, to_date):
|
||||||
"""Get amounts for current and past periods"""
|
"""Get amounts for current and past periods"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user