[Fix] Quality Inspection in Purchase Invoice fixed
This commit is contained in:
committed by
Nabin Hait
parent
c2cd3fd2c6
commit
a8d1bc7ff4
@@ -8,7 +8,8 @@ frappe.provide("erpnext.accounts");
|
|||||||
erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||||
onload: function() {
|
onload: function() {
|
||||||
this._super();
|
this._super();
|
||||||
|
console.log('----> TESTING');
|
||||||
|
this.setup_quality_inspection("Incoming");
|
||||||
if(!this.frm.doc.__islocal) {
|
if(!this.frm.doc.__islocal) {
|
||||||
// show credit_to in print format
|
// show credit_to in print format
|
||||||
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
|
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
|
||||||
|
|||||||
@@ -139,20 +139,20 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
setup_quality_inspection: function(inspection_type) {
|
setup_quality_inspection: function(inspection_type) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var quality_inspection = frappe.meta.get_docfield(this.frm.doc.items[0].doctype, "quality_inspection");
|
var quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
|
||||||
quality_inspection.get_route_options_for_new_doc = function(field) {
|
quality_inspection_field.get_route_options_for_new_doc = function(field) {
|
||||||
|
console.log(field);
|
||||||
if(me.frm.is_new()) return;
|
if(me.frm.is_new()) return;
|
||||||
var doc = field.doc;
|
var doc = field.doc;
|
||||||
return {
|
return {
|
||||||
"inspection_type": inspection_type,
|
"inspection_type": inspection_type,
|
||||||
"purchase_receipt_no": me.frm.doc.name,
|
"purchase_receipt_no": me.frm.doc.name,
|
||||||
"item_code": me.doc.item_code,
|
"item_code": doc.item_code,
|
||||||
"description": me.doc.description,
|
"description": doc.description,
|
||||||
"item_serial_no": me.doc.serial_no ? me.doc.serial_no.split("\n")[0] : null,
|
"item_serial_no": doc.serial_no ? doc.serial_no.split("\n")[0] : null,
|
||||||
"batch_no": me.doc.batch_no
|
"batch_no": doc.batch_no
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(quality_inspection);
|
|
||||||
this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) {
|
this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ 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('----> TESTING');
|
this.setup_quality_inspection("Incoming");
|
||||||
this.setup_quality_inspection("Incoming")
|
|
||||||
},
|
},
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
this._super();
|
this._super();
|
||||||
|
|||||||
Reference in New Issue
Block a user