mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
Removed income and expense related info temporarily from email digest
This commit is contained in:
@@ -5,7 +5,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
doc = locals[dt][dn];
|
doc = locals[dt][dn];
|
||||||
var save_msg = __("You must Save the form before proceeding");
|
var save_msg = __("You must Save the form before proceeding");
|
||||||
var err_msg = __("There was an error. One probable reason could be that you haven't saved the form. Please contact support@erpnext.com if the problem persists.")
|
var err_msg = __("There was an error. One probable reason could be that you haven't saved the form. Please contact support@erpnext.com if the problem persists.")
|
||||||
|
|
||||||
cur_frm.add_custom_button(__('View Now'), function() {
|
cur_frm.add_custom_button(__('View Now'), function() {
|
||||||
doc = locals[dt][dn];
|
doc = locals[dt][dn];
|
||||||
if(doc.__unsaved != 1) {
|
if(doc.__unsaved != 1) {
|
||||||
@@ -27,7 +27,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
msgprint(save_msg);
|
msgprint(save_msg);
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
cur_frm.add_custom_button(__('Send Now'), function() {
|
cur_frm.add_custom_button(__('Send Now'), function() {
|
||||||
doc = locals[dt][dn];
|
doc = locals[dt][dn];
|
||||||
@@ -89,7 +89,7 @@ cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {
|
|||||||
cur_frm.cscript.add_to_rec_list(doc, tab, r.user_list.length);
|
cur_frm.cscript.add_to_rec_list(doc, tab, r.user_list.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
cur_frm.rec_dialog = d;
|
cur_frm.rec_dialog = d;
|
||||||
d.show();
|
d.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"autoname": "Prompt",
|
"autoname": "Prompt",
|
||||||
"creation": "2013-02-21 14:15:31.000000",
|
"creation": "2013-02-21 14:15:31",
|
||||||
"description": "Send regular summary reports via Email.",
|
"description": "Send regular summary reports via Email.",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@@ -9,23 +9,27 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "settings",
|
"fieldname": "settings",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
|
"in_list_view": 0,
|
||||||
"label": "Email Digest Settings",
|
"label": "Email Digest Settings",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break0",
|
"fieldname": "column_break0",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
|
"in_list_view": 0,
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "enabled",
|
"fieldname": "enabled",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Enabled",
|
"label": "Enabled",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "For Company",
|
"label": "For Company",
|
||||||
"options": "link:Company",
|
"options": "link:Company",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@@ -35,6 +39,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"fieldname": "frequency",
|
"fieldname": "frequency",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "How frequently?",
|
"label": "How frequently?",
|
||||||
"options": "Daily\nWeekly\nMonthly",
|
"options": "Daily\nWeekly\nMonthly",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@@ -77,15 +82,10 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "accounts_module",
|
"fieldname": "accounts_module",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Income / Expense",
|
"label": "Income / Expense",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "income_year_to_date",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"label": "Income Year to Date",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"description": "Balances of Accounts of type \"Bank\" or \"Cash\"",
|
"description": "Balances of Accounts of type \"Bank\" or \"Cash\"",
|
||||||
"fieldname": "bank_balance",
|
"fieldname": "bank_balance",
|
||||||
@@ -93,10 +93,18 @@
|
|||||||
"label": "Bank/Cash Balance",
|
"label": "Bank/Cash Balance",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "income_year_to_date",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Income Year to Date",
|
||||||
|
"permlevel": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Income booked for the digest period",
|
"description": "Income booked for the digest period",
|
||||||
"fieldname": "income",
|
"fieldname": "income",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Income Booked",
|
"label": "Income Booked",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
@@ -104,16 +112,10 @@
|
|||||||
"description": "Expenses booked for the digest period",
|
"description": "Expenses booked for the digest period",
|
||||||
"fieldname": "expenses_booked",
|
"fieldname": "expenses_booked",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Expenses Booked",
|
"label": "Expenses Booked",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"description": "Receivable / Payable account will be identified based on the field Master Type",
|
|
||||||
"fieldname": "column_break_16",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"label": "Receivables / Payables",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"description": "Payments received during the digest period",
|
"description": "Payments received during the digest period",
|
||||||
"fieldname": "collections",
|
"fieldname": "collections",
|
||||||
@@ -128,6 +130,13 @@
|
|||||||
"label": "Payments Made",
|
"label": "Payments Made",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Receivable / Payable account will be identified based on the field Master Type",
|
||||||
|
"fieldname": "column_break_16",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"label": "Receivables / Payables",
|
||||||
|
"permlevel": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Total amount of invoices sent to the customer during the digest period",
|
"description": "Total amount of invoices sent to the customer during the digest period",
|
||||||
"fieldname": "invoiced_amount",
|
"fieldname": "invoiced_amount",
|
||||||
@@ -319,7 +328,7 @@
|
|||||||
],
|
],
|
||||||
"icon": "icon-envelope",
|
"icon": "icon-envelope",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"modified": "2014-03-19 11:39:27.000000",
|
"modified": "2014-04-28 17:21:08.300969",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Email Digest",
|
"name": "Email Digest",
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ from frappe.utils.email_lib import sendmail
|
|||||||
from frappe.core.doctype.user.user import STANDARD_USERS
|
from frappe.core.doctype.user.user import STANDARD_USERS
|
||||||
|
|
||||||
content_sequence = [
|
content_sequence = [
|
||||||
["Income / Expenses", ["income_year_to_date", "bank_balance",
|
# ["Income / Expenses", ["income_year_to_date", "bank_balance",
|
||||||
"income", "expenses_booked"]],
|
# "income", "expenses_booked"]],
|
||||||
["Receivables / Payables", ["collections", "payments",
|
["Receivables / Payables", ["collections", "payments",
|
||||||
"invoiced_amount", "payables"]],
|
"invoiced_amount", "payables"]],
|
||||||
|
["Bank Balance", ["bank_balance"]],
|
||||||
["Buying", ["new_purchase_requests", "new_supplier_quotations", "new_purchase_orders"]],
|
["Buying", ["new_purchase_requests", "new_supplier_quotations", "new_purchase_orders"]],
|
||||||
["Selling", ["new_leads", "new_enquiries", "new_quotations", "new_sales_orders"]],
|
["Selling", ["new_leads", "new_enquiries", "new_quotations", "new_sales_orders"]],
|
||||||
["Stock", ["new_delivery_notes", "new_purchase_receipts", "new_stock_entries"]],
|
["Stock", ["new_delivery_notes", "new_purchase_receipts", "new_stock_entries"]],
|
||||||
@@ -153,9 +154,9 @@ class EmailDigest(Document):
|
|||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def get_income_year_to_date(self):
|
# def get_income_year_to_date(self):
|
||||||
return self.get_income(frappe.db.get_defaults("year_start_date"),
|
# return self.get_income(frappe.db.get_defaults("year_start_date"),
|
||||||
self.meta.get_label("income_year_to_date"))
|
# self.meta.get_label("income_year_to_date"))
|
||||||
|
|
||||||
def get_bank_balance(self):
|
def get_bank_balance(self):
|
||||||
# account is of type "Bank" or "Cash"
|
# account is of type "Bank" or "Cash"
|
||||||
@@ -175,29 +176,29 @@ class EmailDigest(Document):
|
|||||||
fmt_money(accounts[ac][1]), style="margin-left: 17px")
|
fmt_money(accounts[ac][1]), style="margin-left: 17px")
|
||||||
return sum((accounts[ac][1] for ac in ackeys)), out
|
return sum((accounts[ac][1] for ac in ackeys)), out
|
||||||
|
|
||||||
def get_income(self, from_date=None, label=None):
|
# def get_income(self, from_date=None, label=None):
|
||||||
# account is PL Account and Credit type account
|
# # account is PL Account and Credit type account
|
||||||
accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Income"]
|
# accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Income"]
|
||||||
|
#
|
||||||
income = 0
|
# income = 0
|
||||||
for gle in self.get_gl_entries(from_date or self.from_date, self.to_date):
|
# for gle in self.get_gl_entries(from_date or self.from_date, self.to_date):
|
||||||
if gle["account"] in accounts:
|
# if gle["account"] in accounts:
|
||||||
income += gle["credit"] - gle["debit"]
|
# income += gle["credit"] - gle["debit"]
|
||||||
|
#
|
||||||
return income, self.get_html(label or self.meta.get_label("income"), self.currency,
|
# return income, self.get_html(label or self.meta.get_label("income"), self.currency,
|
||||||
fmt_money(income))
|
# fmt_money(income))
|
||||||
|
#
|
||||||
def get_expenses_booked(self):
|
# def get_expenses_booked(self):
|
||||||
# account is PL Account and Debit type account
|
# # account is PL Account and Debit type account
|
||||||
accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Expense"]
|
# accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Expense"]
|
||||||
|
#
|
||||||
expense = 0
|
# expense = 0
|
||||||
for gle in self.get_gl_entries(self.from_date, self.to_date):
|
# for gle in self.get_gl_entries(self.from_date, self.to_date):
|
||||||
if gle["account"] in accounts:
|
# if gle["account"] in accounts:
|
||||||
expense += gle["debit"] - gle["credit"]
|
# expense += gle["debit"] - gle["credit"]
|
||||||
|
#
|
||||||
return expense, self.get_html(self.meta.get_label("expenses_booked"), self.currency,
|
# return expense, self.get_html(self.meta.get_label("expenses_booked"), self.currency,
|
||||||
fmt_money(expense))
|
# fmt_money(expense))
|
||||||
|
|
||||||
def get_collections(self):
|
def get_collections(self):
|
||||||
return self.get_party_total("Customer", "credit", self.meta.get_label("collections"))
|
return self.get_party_total("Customer", "credit", self.meta.get_label("collections"))
|
||||||
@@ -389,8 +390,7 @@ class EmailDigest(Document):
|
|||||||
|
|
||||||
def get_accounts(self):
|
def get_accounts(self):
|
||||||
if not hasattr(self, "accounts"):
|
if not hasattr(self, "accounts"):
|
||||||
self.accounts = frappe.db.sql("""select name, is_pl_account,
|
self.accounts = frappe.db.sql("""select name, account_type, account_name, master_type
|
||||||
root_type, account_type, account_name, master_type
|
|
||||||
from `tabAccount` where company=%s and docstatus < 2
|
from `tabAccount` where company=%s and docstatus < 2
|
||||||
and group_or_ledger = "Ledger" order by lft""",
|
and group_or_ledger = "Ledger" order by lft""",
|
||||||
(self.company,), as_dict=1)
|
(self.company,), as_dict=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user