fix: membership renewal validation (#24963)
This commit is contained in:
parent
a85959f574
commit
5e1cb5e4bc
@ -48,7 +48,7 @@ class Membership(Document):
|
|||||||
last_membership = erpnext.get_last_membership(self.member)
|
last_membership = erpnext.get_last_membership(self.member)
|
||||||
|
|
||||||
# if person applied for offline membership
|
# if person applied for offline membership
|
||||||
if last_membership and last_membership != self.name and not frappe.session.user == "Administrator":
|
if last_membership and last_membership.name != self.name and not frappe.session.user == "Administrator":
|
||||||
# if last membership does not expire in 30 days, then do not allow to renew
|
# if last membership does not expire in 30 days, then do not allow to renew
|
||||||
if getdate(add_days(last_membership.to_date, -30)) > getdate(nowdate()) :
|
if getdate(add_days(last_membership.to_date, -30)) > getdate(nowdate()) :
|
||||||
frappe.throw(_("You can only renew if your membership expires within 30 days"))
|
frappe.throw(_("You can only renew if your membership expires within 30 days"))
|
||||||
@ -90,6 +90,7 @@ class Membership(Document):
|
|||||||
self.validate_membership_type_and_settings(plan, settings)
|
self.validate_membership_type_and_settings(plan, settings)
|
||||||
|
|
||||||
invoice = make_invoice(self, member, plan, settings)
|
invoice = make_invoice(self, member, plan, settings)
|
||||||
|
self.reload()
|
||||||
self.invoice = invoice.name
|
self.invoice = invoice.name
|
||||||
|
|
||||||
if with_payment_entry:
|
if with_payment_entry:
|
||||||
@ -284,6 +285,7 @@ def trigger_razorpay_subscription(*args, **kwargs):
|
|||||||
|
|
||||||
settings = frappe.get_doc("Non Profit Settings")
|
settings = frappe.get_doc("Non Profit Settings")
|
||||||
if settings.allow_invoicing and settings.automate_membership_invoicing:
|
if settings.allow_invoicing and settings.automate_membership_invoicing:
|
||||||
|
membership.reload()
|
||||||
membership.generate_invoice(with_payment_entry=settings.automate_membership_payment_entries, save=True)
|
membership.generate_invoice(with_payment_entry=settings.automate_membership_payment_entries, save=True)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user