From 79e5b07e6286c970c4c40bcf4de7f96a3f3cf08d Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 21 Jun 2018 12:58:14 +0530 Subject: [PATCH] [Fix] Subscription method (#14604) * [Fix] Subscription method path * [Fix] Condition --- .../doctype/purchase_invoice/purchase_invoice.js | 2 +- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 2 +- erpnext/buying/doctype/purchase_order/purchase_order.js | 2 +- .../doctype/supplier_quotation/supplier_quotation.js | 9 ++++++--- erpnext/public/js/utils.js | 2 +- erpnext/selling/doctype/quotation/quotation.js | 2 +- erpnext/selling/doctype/sales_order/sales_order.js | 2 +- erpnext/stock/doctype/delivery_note/delivery_note.js | 2 +- .../stock/doctype/purchase_receipt/purchase_receipt.js | 2 +- 9 files changed, 14 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 1a7f3e9ea9..9a9fe20a6d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -71,7 +71,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ 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 ad097c0542..8f57352e78 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -88,7 +88,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte 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 671408f5a1..8cf56e1f89 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -125,7 +125,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( 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 3899bbab11..1b4ce6a5ea 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -22,9 +22,12 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext 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 1f7cca178f..abbade0bca 100644 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -146,7 +146,7 @@ $.extend(erpnext.utils, { 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 63e85fd0ab..ff4add2d8e 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -60,7 +60,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ 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 9a2311d6b0..c1e790c96a 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -158,7 +158,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( 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 a2faa9a6a3..0d9dbe6b51 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.DeliveryNoteController = erpnext.selling.SellingController.extend( } 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 9289d69f6e..2290e2fb65 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -117,7 +117,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend } 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"))