Merge pull request #38325 from frappe/mergify/bp/version-15-hotfix/pr-38273
fix: annual income and expenses in email digest (#38273)
This commit is contained in:
commit
18f9650188
@ -183,6 +183,7 @@ def get_balance_on(
|
|||||||
cost_center=None,
|
cost_center=None,
|
||||||
ignore_account_permission=False,
|
ignore_account_permission=False,
|
||||||
account_type=None,
|
account_type=None,
|
||||||
|
start_date=None,
|
||||||
):
|
):
|
||||||
if not account and frappe.form_dict.get("account"):
|
if not account and frappe.form_dict.get("account"):
|
||||||
account = frappe.form_dict.get("account")
|
account = frappe.form_dict.get("account")
|
||||||
@ -196,6 +197,8 @@ def get_balance_on(
|
|||||||
cost_center = frappe.form_dict.get("cost_center")
|
cost_center = frappe.form_dict.get("cost_center")
|
||||||
|
|
||||||
cond = ["is_cancelled=0"]
|
cond = ["is_cancelled=0"]
|
||||||
|
if start_date:
|
||||||
|
cond.append("posting_date >= %s" % frappe.db.escape(cstr(start_date)))
|
||||||
if date:
|
if date:
|
||||||
cond.append("posting_date <= %s" % frappe.db.escape(cstr(date)))
|
cond.append("posting_date <= %s" % frappe.db.escape(cstr(date)))
|
||||||
else:
|
else:
|
||||||
|
@ -382,9 +382,10 @@ class EmailDigest(Document):
|
|||||||
"""Get income to date"""
|
"""Get income to date"""
|
||||||
balance = 0.0
|
balance = 0.0
|
||||||
count = 0
|
count = 0
|
||||||
|
fy_start_date = get_fiscal_year(self.future_to_date)[1]
|
||||||
|
|
||||||
for account in self.get_root_type_accounts(root_type):
|
for account in self.get_root_type_accounts(root_type):
|
||||||
balance += get_balance_on(account, date=self.future_to_date)
|
balance += get_balance_on(account, date=self.future_to_date, start_date=fy_start_date)
|
||||||
count += get_count_on(account, fieldname, date=self.future_to_date)
|
count += get_count_on(account, fieldname, date=self.future_to_date)
|
||||||
|
|
||||||
if fieldname == "income":
|
if fieldname == "income":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user