mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
Function in parent transaction.js and call from corresponding files
This commit is contained in:
committed by
Nabin Hait
parent
cc90241fa5
commit
c2cd3fd2c6
@@ -1013,11 +1013,11 @@
|
|||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Quality Inspection",
|
"label": "Quality Inspection",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 1,
|
||||||
"options": "Quality Inspection",
|
"options": "Quality Inspection",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 1,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
@@ -1814,7 +1814,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-11-10 01:53:28.457971",
|
"modified": "2016-11-11 05:26:47.383600",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice Item",
|
"name": "Purchase Invoice Item",
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
},
|
},
|
||||||
onload: function() {
|
onload: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
//this.frm.show_print_first = true;
|
|
||||||
if(this.frm.doc.__islocal) {
|
if(this.frm.doc.__islocal) {
|
||||||
var today = get_today(),
|
var today = get_today(),
|
||||||
currency = frappe.defaults.get_user_default("currency");
|
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() {
|
onload_post_render: function() {
|
||||||
@@ -1005,31 +1031,5 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
return method
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
@@ -7,21 +7,6 @@ frappe.provide("erpnext.stock");
|
|||||||
|
|
||||||
frappe.ui.form.on("Purchase Receipt", {
|
frappe.ui.form.on("Purchase Receipt", {
|
||||||
onload: function(frm) {
|
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) {
|
$.each(["warehouse", "rejected_warehouse"], function(i, field) {
|
||||||
frm.set_query(field, "items", function() {
|
frm.set_query(field, "items", function() {
|
||||||
return {
|
return {
|
||||||
@@ -48,9 +33,8 @@ frappe.ui.form.on("Purchase Receipt", {
|
|||||||
erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
|
erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
|
||||||
onload: function() {
|
onload: function() {
|
||||||
this._super();
|
this._super();
|
||||||
console.log(' before onload2');
|
console.log('----> TESTING');
|
||||||
//this.setup_inspection_required_filter('Incoming');
|
this.setup_quality_inspection("Incoming")
|
||||||
this.setup_quality_inspection("Purchase Receipt Item","Incoming")
|
|
||||||
},
|
},
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
this._super();
|
this._super();
|
||||||
|
|||||||
Reference in New Issue
Block a user