mirror of
https://github.com/frappe/erpnext.git
synced 2026-10-29 22:57:42 +00:00
fix(accounts): honor the full subscription grace period
This commit is contained in:
@@ -269,11 +269,11 @@ class Subscription(Document):
|
||||
"""
|
||||
Returns `True` if the grace period for the `Subscription` has passed
|
||||
"""
|
||||
if not self.current_invoice_is_past_due():
|
||||
return
|
||||
if not self.current_invoice_is_past_due(posting_date):
|
||||
return False
|
||||
|
||||
grace_period = cint(frappe.get_value("Subscription Settings", None, "grace_period"))
|
||||
return getdate(posting_date) >= getdate(add_days(self.current_invoice.due_date, grace_period))
|
||||
return getdate(posting_date) > getdate(add_days(self.current_invoice.due_date, grace_period))
|
||||
|
||||
def current_invoice_is_past_due(self, posting_date: DateTimeLikeObject | None = None) -> bool:
|
||||
"""
|
||||
@@ -282,7 +282,7 @@ class Subscription(Document):
|
||||
if not self.current_invoice or self.is_paid(self.current_invoice):
|
||||
return False
|
||||
|
||||
return getdate(posting_date) >= getdate(self.current_invoice.due_date)
|
||||
return getdate(posting_date) > getdate(self.current_invoice.due_date)
|
||||
|
||||
@property
|
||||
def invoice_document_type(self) -> str:
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"default": "1",
|
||||
"description": "Number of days after invoice date has elapsed before canceling subscription or marking subscription as unpaid",
|
||||
"description": "Number of days after the invoice due date before canceling the subscription or marking it as unpaid",
|
||||
"fieldname": "grace_period",
|
||||
"fieldtype": "Int",
|
||||
"label": "Grace Period"
|
||||
@@ -32,7 +32,7 @@
|
||||
],
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2020-06-23 09:13:44.292792",
|
||||
"modified": "2026-10-19 16:50:55.834144",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Subscription Settings",
|
||||
|
||||
Reference in New Issue
Block a user