{"size": 798, "ext": "js", "max_stars_repo_path": "medtech_bpa/medtech_bpa/custom_scripts/quality_inspection/quality_inspection.js", "max_stars_repo_name": "sds2402/MedTech-BPA-1", "max_stars_repo_stars_event_min_datetime": "2021-03-25T12:56:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-25T12:56:57.000Z", "max_issues_repo_path": "medtech_bpa/medtech_bpa/custom_scripts/quality_inspection/quality_inspection.js", "max_issues_repo_name": "sds2402/MedTech-BPA-1", "max_issues_repo_issues_event_min_datetime": "2021-11-08T07:20:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-08T07:20:32.000Z", "max_forks_repo_path": "medtech_bpa/medtech_bpa/custom_scripts/quality_inspection/quality_inspection.js", "max_forks_repo_name": "sds2402/MedTech-BPA-1", "max_forks_repo_forks_event_min_datetime": "2021-01-04T10:21:57.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-08T12:44:48.000Z"}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": 9, "avg_line_length": 24.9375, "max_line_length": 72, "alphanum_fraction": 0.6892230576}

frappe.ui.form.on("Quality Inspection", {
	refresh :function(frm,cdt,cdn){
		if(frm.doc.reference_type == 'Purchase Receipt'){
			frm.set_df_property('rejected_warehouse', 'reqd', 1)
		}
		set_rejected_warehouse(frm)
	},
	reference_type :function(frm,cdt,cdn){
		if(frm.doc.reference_type == 'Purchase Receipt'){
			frm.set_df_property('rejected_warehouse', 'reqd', 1)
		}
	}
})

function set_rejected_warehouse(frm){
	frappe.call({
			method: "frappe.client.get_value",
			args: {
				doctype: "MedTech Settings",
				fieldname: ['rejected_warehouse']
			},
		async :false,
		callback: function(r) {
			if(r.message) {
				console.log(r.message['rejected_warehouse'])
				frm.set_value('rejected_warehouse', r.message['rejected_warehouse'])
				refresh_field('rejected_warehouse')
			}
		}
	});
}