Removed income and expense related info temporarily from email digest
This commit is contained in:
parent
6777efa7fa
commit
17910aa0d6
@ -5,7 +5,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
doc = locals[dt][dn];
|
||||
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.")
|
||||
|
||||
|
||||
cur_frm.add_custom_button(__('View Now'), function() {
|
||||
doc = locals[dt][dn];
|
||||
if(doc.__unsaved != 1) {
|
||||
@ -27,7 +27,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
});
|
||||
} else {
|
||||
msgprint(save_msg);
|
||||
}
|
||||
}
|
||||
}, 1);
|
||||
cur_frm.add_custom_button(__('Send Now'), function() {
|
||||
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.rec_dialog = d;
|
||||
cur_frm.rec_dialog = d;
|
||||
d.show();
|
||||
}
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"autoname": "Prompt",
|
||||
"creation": "2013-02-21 14:15:31.000000",
|
||||
"creation": "2013-02-21 14:15:31",
|
||||
"description": "Send regular summary reports via Email.",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
@ -9,23 +9,27 @@
|
||||
{
|
||||
"fieldname": "settings",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Email Digest Settings",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"in_list_view": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "enabled",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Enabled",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "For Company",
|
||||
"options": "link:Company",
|
||||
"permlevel": 0,
|
||||
@ -35,6 +39,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "frequency",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "How frequently?",
|
||||
"options": "Daily\nWeekly\nMonthly",
|
||||
"permlevel": 0,
|
||||
@ -77,15 +82,10 @@
|
||||
{
|
||||
"fieldname": "accounts_module",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 1,
|
||||
"label": "Income / Expense",
|
||||
"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\"",
|
||||
"fieldname": "bank_balance",
|
||||
@ -93,10 +93,18 @@
|
||||
"label": "Bank/Cash Balance",
|
||||
"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",
|
||||
"fieldname": "income",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"label": "Income Booked",
|
||||
"permlevel": 0
|
||||
},
|
||||
@ -104,16 +112,10 @@
|
||||
"description": "Expenses booked for the digest period",
|
||||
"fieldname": "expenses_booked",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"label": "Expenses Booked",
|
||||
"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",
|
||||
"fieldname": "collections",
|
||||
@ -128,6 +130,13 @@
|
||||
"label": "Payments Made",
|
||||
"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",
|
||||
"fieldname": "invoiced_amount",
|
||||
@ -319,7 +328,7 @@
|
||||
],
|
||||
"icon": "icon-envelope",
|
||||
"idx": 1,
|
||||
"modified": "2014-03-19 11:39:27.000000",
|
||||
"modified": "2014-04-28 17:21:08.300969",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Email Digest",
|
||||
|
@ -13,10 +13,11 @@ from frappe.utils.email_lib import sendmail
|
||||
from frappe.core.doctype.user.user import STANDARD_USERS
|
||||
|
||||
content_sequence = [
|
||||
["Income / Expenses", ["income_year_to_date", "bank_balance",
|
||||
"income", "expenses_booked"]],
|
||||
# ["Income / Expenses", ["income_year_to_date", "bank_balance",
|
||||
# "income", "expenses_booked"]],
|
||||
["Receivables / Payables", ["collections", "payments",
|
||||
"invoiced_amount", "payables"]],
|
||||
["Bank Balance", ["bank_balance"]],
|
||||
["Buying", ["new_purchase_requests", "new_supplier_quotations", "new_purchase_orders"]],
|
||||
["Selling", ["new_leads", "new_enquiries", "new_quotations", "new_sales_orders"]],
|
||||
["Stock", ["new_delivery_notes", "new_purchase_receipts", "new_stock_entries"]],
|
||||
@ -153,9 +154,9 @@ class EmailDigest(Document):
|
||||
|
||||
return msg
|
||||
|
||||
def get_income_year_to_date(self):
|
||||
return self.get_income(frappe.db.get_defaults("year_start_date"),
|
||||
self.meta.get_label("income_year_to_date"))
|
||||
# def get_income_year_to_date(self):
|
||||
# return self.get_income(frappe.db.get_defaults("year_start_date"),
|
||||
# self.meta.get_label("income_year_to_date"))
|
||||
|
||||
def get_bank_balance(self):
|
||||
# account is of type "Bank" or "Cash"
|
||||
@ -175,29 +176,29 @@ class EmailDigest(Document):
|
||||
fmt_money(accounts[ac][1]), style="margin-left: 17px")
|
||||
return sum((accounts[ac][1] for ac in ackeys)), out
|
||||
|
||||
def get_income(self, from_date=None, label=None):
|
||||
# account is PL Account and Credit type account
|
||||
accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Income"]
|
||||
|
||||
income = 0
|
||||
for gle in self.get_gl_entries(from_date or self.from_date, self.to_date):
|
||||
if gle["account"] in accounts:
|
||||
income += gle["credit"] - gle["debit"]
|
||||
|
||||
return income, self.get_html(label or self.meta.get_label("income"), self.currency,
|
||||
fmt_money(income))
|
||||
|
||||
def get_expenses_booked(self):
|
||||
# account is PL Account and Debit type account
|
||||
accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Expense"]
|
||||
|
||||
expense = 0
|
||||
for gle in self.get_gl_entries(self.from_date, self.to_date):
|
||||
if gle["account"] in accounts:
|
||||
expense += gle["debit"] - gle["credit"]
|
||||
|
||||
return expense, self.get_html(self.meta.get_label("expenses_booked"), self.currency,
|
||||
fmt_money(expense))
|
||||
# def get_income(self, from_date=None, label=None):
|
||||
# # account is PL Account and Credit type account
|
||||
# accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Income"]
|
||||
#
|
||||
# income = 0
|
||||
# for gle in self.get_gl_entries(from_date or self.from_date, self.to_date):
|
||||
# if gle["account"] in accounts:
|
||||
# income += gle["credit"] - gle["debit"]
|
||||
#
|
||||
# return income, self.get_html(label or self.meta.get_label("income"), self.currency,
|
||||
# fmt_money(income))
|
||||
#
|
||||
# def get_expenses_booked(self):
|
||||
# # account is PL Account and Debit type account
|
||||
# accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Expense"]
|
||||
#
|
||||
# expense = 0
|
||||
# for gle in self.get_gl_entries(self.from_date, self.to_date):
|
||||
# if gle["account"] in accounts:
|
||||
# expense += gle["debit"] - gle["credit"]
|
||||
#
|
||||
# return expense, self.get_html(self.meta.get_label("expenses_booked"), self.currency,
|
||||
# fmt_money(expense))
|
||||
|
||||
def get_collections(self):
|
||||
return self.get_party_total("Customer", "credit", self.meta.get_label("collections"))
|
||||
@ -389,8 +390,7 @@ class EmailDigest(Document):
|
||||
|
||||
def get_accounts(self):
|
||||
if not hasattr(self, "accounts"):
|
||||
self.accounts = frappe.db.sql("""select name, is_pl_account,
|
||||
root_type, account_type, account_name, master_type
|
||||
self.accounts = frappe.db.sql("""select name, account_type, account_name, master_type
|
||||
from `tabAccount` where company=%s and docstatus < 2
|
||||
and group_or_ledger = "Ledger" order by lft""",
|
||||
(self.company,), as_dict=1)
|
||||
|
Loading…
Reference in New Issue
Block a user