[Fix] Subscription method (#14604)
* [Fix] Subscription method path
* [Fix] Condition
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 1a7f3e9..9a9fe20 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -71,7 +71,7 @@
this.make_debit_note, __("Make"));
}
- if(!doc.subscription) {
+ if(!doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(doc.doctype, doc.name)
}, __("Make"))
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index ad097c0..8f57352 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -88,7 +88,7 @@
this.make_payment_request, __("Make"));
}
- if(!doc.subscription) {
+ if(!doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(doc.doctype, doc.name)
}, __("Make"))
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 671408f..8cf56e1 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -125,7 +125,7 @@
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_payment_entry, __("Make"));
}
- if(!doc.subscription) {
+ if(!doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(doc.doctype, doc.name)
}, __("Make"))
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index 3899bba..1b4ce6a 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -22,9 +22,12 @@
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
cur_frm.add_custom_button(__("Quotation"), this.make_quotation,
__("Make"));
- cur_frm.add_custom_button(__('Subscription'), function() {
- erpnext.utils.make_subscription(me.frm.doc.doctype, me.frm.doc.name)
- }, __("Make"))
+
+ if(!this.frm.doc.auto_repeat) {
+ cur_frm.add_custom_button(__('Subscription'), function() {
+ erpnext.utils.make_subscription(me.frm.doc.doctype, me.frm.doc.name)
+ }, __("Make"))
+ }
}
else if (this.frm.doc.docstatus===0) {
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 1f7cca1..abbade0 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -146,7 +146,7 @@
make_subscription: function(doctype, docname) {
frappe.call({
- method: "erpnext.accounts.doctype.subscription.subscription.make_subscription",
+ method: "frappe.desk.doctype.auto_repeat.auto_repeat.make_auto_repeat",
args: {
doctype: doctype,
docname: docname
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 63e85fd..ff4add2 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -60,7 +60,7 @@
cur_frm.cscript['Declare Order Lost']);
}
- if(!doc.subscription) {
+ if(!doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(doc.doctype, doc.name)
}, __("Make"))
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 9a2311d..c1e790c 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -158,7 +158,7 @@
function() { me.make_project() }, __("Make"));
}
- if(!doc.subscription) {
+ if(!doc.auto_repeat) {
this.frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(doc.doctype, doc.name)
}, __("Make"))
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index a2faa9a..0d9dbe6 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -167,7 +167,7 @@
}
erpnext.stock.delivery_note.set_print_hide(doc, dt, dn);
- if(doc.docstatus==1 && !doc.subscription) {
+ if(doc.docstatus==1 && !doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(doc.doctype, doc.name)
}, __("Make"))
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 9289d69..2290e2f 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -117,7 +117,7 @@
}
cur_frm.add_custom_button(__('Retention Stock Entry'), this.make_retention_stock_entry, __("Make"));
- if(!this.frm.doc.subscription) {
+ if(!this.frm.doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(me.frm.doc.doctype, me.frm.doc.name)
}, __("Make"))