mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
feat(process statement of accounts): added more frequency options for auto email
This commit is contained in:
@@ -70,7 +70,7 @@
|
|||||||
"fieldname": "frequency",
|
"fieldname": "frequency",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Frequency",
|
"label": "Frequency",
|
||||||
"options": "Weekly\nMonthly\nQuarterly"
|
"options": "Daily\nWeekly\nBiweekly\nMonthly\nQuarterly"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
@@ -417,7 +417,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-10-07 11:17:05.444394",
|
"modified": "2025-10-07 12:19:20.719898",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Process Statement Of Accounts",
|
"name": "Process Statement Of Accounts",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import frappe
|
|||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.desk.reportview import get_match_cond
|
from frappe.desk.reportview import get_match_cond
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import add_days, add_months, format_date, getdate, today
|
from frappe.utils import add_days, add_months, add_to_date, format_date, getdate, today
|
||||||
from frappe.utils.jinja import validate_template
|
from frappe.utils.jinja import validate_template
|
||||||
from frappe.utils.pdf import get_pdf
|
from frappe.utils.pdf import get_pdf
|
||||||
from frappe.www.printview import get_print_style
|
from frappe.www.printview import get_print_style
|
||||||
@@ -55,7 +55,7 @@ class ProcessStatementOfAccounts(Document):
|
|||||||
enable_auto_email: DF.Check
|
enable_auto_email: DF.Check
|
||||||
filter_duration: DF.Int
|
filter_duration: DF.Int
|
||||||
finance_book: DF.Link | None
|
finance_book: DF.Link | None
|
||||||
frequency: DF.Literal["Weekly", "Monthly", "Quarterly"]
|
frequency: DF.Literal["Daily", "Weekly", "Biweekly", "Monthly", "Quarterly"]
|
||||||
from_date: DF.Date | None
|
from_date: DF.Date | None
|
||||||
ignore_cr_dr_notes: DF.Check
|
ignore_cr_dr_notes: DF.Check
|
||||||
ignore_exchange_rate_revaluation_journals: DF.Check
|
ignore_exchange_rate_revaluation_journals: DF.Check
|
||||||
@@ -555,8 +555,9 @@ def send_emails(document_name, from_scheduler=False, posting_date=None):
|
|||||||
|
|
||||||
if doc.enable_auto_email and from_scheduler:
|
if doc.enable_auto_email and from_scheduler:
|
||||||
new_to_date = getdate(posting_date or today())
|
new_to_date = getdate(posting_date or today())
|
||||||
if doc.frequency == "Weekly":
|
if doc.frequency in ("Daily", "Weekly", "Biweekly"):
|
||||||
new_to_date = add_days(new_to_date, 7)
|
frequency = {"Daily": 1, "Weekly": 7, "Biweekly": 14}
|
||||||
|
new_to_date = add_days(new_to_date, frequency[doc.frequency])
|
||||||
else:
|
else:
|
||||||
new_to_date = add_months(new_to_date, 1 if doc.frequency == "Monthly" else 3)
|
new_to_date = add_months(new_to_date, 1 if doc.frequency == "Monthly" else 3)
|
||||||
new_from_date = add_months(new_to_date, -1 * doc.filter_duration)
|
new_from_date = add_months(new_to_date, -1 * doc.filter_duration)
|
||||||
|
|||||||
Reference in New Issue
Block a user