diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index 70c6ba2378..ddd2d48022 100755 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -1013,11 +1013,11 @@ "in_standard_filter": 0, "label": "Quality Inspection", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Quality Inspection", "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1814,7 +1814,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-11-10 01:53:28.457971", + "modified": "2016-11-11 05:26:47.383600", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index a301c96925..e6bc00b289 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -83,7 +83,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ }, onload: function() { var me = this; - //this.frm.show_print_first = true; if(this.frm.doc.__islocal) { var today = get_today(), currency = frappe.defaults.get_user_default("currency"); @@ -136,7 +135,34 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } }); } + }, + setup_quality_inspection: function(inspection_type) { + var me = this; + var quality_inspection = frappe.meta.get_docfield(this.frm.doc.items[0].doctype, "quality_inspection"); + quality_inspection.get_route_options_for_new_doc = function(field) { + if(me.frm.is_new()) return; + var doc = field.doc; + return { + "inspection_type": inspection_type, + "purchase_receipt_no": me.frm.doc.name, + "item_code": me.doc.item_code, + "description": me.doc.description, + "item_serial_no": me.doc.serial_no ? me.doc.serial_no.split("\n")[0] : null, + "batch_no": me.doc.batch_no + } + } + console.log(quality_inspection); + this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { + var d = locals[cdt][cdn]; + return { + filters: { + docstatus: 1, + inspection_type: inspection_type, + item_code: d.item_code + } + } + }); }, onload_post_render: function() { @@ -1005,31 +1031,5 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ return method }, - - setup_quality_inspection: function(doctype_name, inspection_type) { - var quality_inspection = frappe.meta.get_docfield(doctype_name, "quality_inspection"); - quality_inspection.get_route_options_for_new_doc = function(field) { - if(frm.is_new()) return; - var doc = field.doc; - return { - "inspection_type": inspection_type, - "purchase_receipt_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 - } - } - this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - return { - filters: { - docstatus: 1, - inspection_type: inspection_type, - item_code: d.item_code - } - } - }); - - } + }); \ No newline at end of file diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 526a109391..e4fcaa9bdf 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -7,21 +7,6 @@ frappe.provide("erpnext.stock"); frappe.ui.form.on("Purchase Receipt", { onload: function(frm) { - console.log('onload1'); - var quality_inspection = frappe.meta.get_docfield("Purchase Receipt 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": "Incoming", - "purchase_receipt_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 - } - } - console.log(quality_inspection); $.each(["warehouse", "rejected_warehouse"], function(i, field) { frm.set_query(field, "items", function() { return { @@ -48,9 +33,8 @@ frappe.ui.form.on("Purchase Receipt", { erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ onload: function() { this._super(); - console.log(' before onload2'); - //this.setup_inspection_required_filter('Incoming'); - this.setup_quality_inspection("Purchase Receipt Item","Incoming") + console.log('----> TESTING'); + this.setup_quality_inspection("Incoming") }, refresh: function() { this._super();