From dbc2511a395e9fe69945cc5fb0cd140c68290587 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 16 Nov 2016 15:06:08 +0530 Subject: [PATCH] [Fix] Delivery Note fixed --- .../purchase_invoice/purchase_invoice.js | 7 +++-- erpnext/public/js/controllers/transaction.js | 3 +- .../doctype/delivery_note/delivery_note.js | 28 ++++--------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index ca66ee25b4..ee25272f8c 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -8,8 +8,7 @@ frappe.provide("erpnext.accounts"); erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ onload: function() { this._super(); - console.log('----> TESTING'); - this.setup_quality_inspection("Incoming"); + if(!this.frm.doc.__islocal) { // show credit_to in print format if(!this.frm.doc.supplier && this.frm.doc.credit_to) { @@ -34,6 +33,10 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ this.show_stock_ledger(); } + if (doc.update_stock==1){ + this.setup_quality_inspection("Incoming"); + } + if(!doc.is_return && doc.docstatus==1) { if(doc.outstanding_amount != 0) { this.frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make")); diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 2e07e4ff66..53a489c830 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -146,14 +146,13 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ return { "inspection_type": inspection_type, "reference_type": me.frm.doc.doctype, - "purchase_receipt": me.frm.doc.name, + "reference_name": me.frm.doc.name, "item_code": doc.item_code, "description": doc.description, "item_serial_no": doc.serial_no ? doc.serial_no.split("\n")[0] : null, "batch_no": doc.batch_no } } - console.log(quality_inspection_field); this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { var d = locals[cdt][cdn]; return { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 2597280876..baeb069d88 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -8,19 +8,6 @@ frappe.provide("erpnext.stock.delivery_note"); frappe.ui.form.on("Delivery Note", { setup: function(frm) { - var quality_inspection = frappe.meta.get_docfield("Delivery Note Item", "quality_inspection"); - quality_inspection.get_route_options_for_new_doc = function(field) { - if(frm.is_new()) return; - var doc = field.doc; - return { - "inspection_type": "Outgoing", - "delivery_note_no": frm.doc.name, - "item_code": doc.item_code, - "description": doc.description, - "item_serial_no": doc.serial_no ? doc.serial_no.split("\n")[0] : null, - "batch_no": doc.batch_no - } - } frm.set_indicator_formatter('item_code', function(doc) { @@ -36,20 +23,15 @@ frappe.ui.form.on("Delivery Note", { } }) - frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - return { - filters: { - docstatus: 1, - inspection_type: "Outgoing", - item_code: d.item_code - } - } - }) } }); erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({ + onload: function() { + this._super(); + this.setup_quality_inspection("Outgoing"); + }, + refresh: function(doc, dt, dn) { this._super(); if (!doc.is_return && doc.status!="Closed") {