Skip to content

Commit

Permalink
fix(Package Subscription): restrict payment for draft subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajinsr committed Dec 23, 2024
1 parent b13dc71 commit 490a481
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ frappe.ui.form.on("Package Subscription", {
},

refresh: function (frm) {
if (frm.doc.outstanding_amount > 0) {
if (frm.doc.outstanding_amount > 0 && frm.doc.docstatus == 1) {
frm.add_custom_button(__("Payment Entry"), function() {
frappe.call({
method: "healthcare.healthcare.doctype.package_subscription.package_subscription.create_payment_entry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class PackageSubscription(Document):
def validate(self):
self.get_package_details()
if self.total_package_amount:
self.outstanding_amount = self.total_package_amount - self.paid_amount

Expand Down

0 comments on commit 490a481

Please sign in to comment.