<commit_before>// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
{% include "erpnext/public/js/controllers/accounts.js" %}

frappe.ui.form.on('Payment Entry', {
	onload: function(frm) {
		if(frm.doc.__islocal) {
			if (!frm.doc.paid_from) frm.set_value("paid_from_account_currency", null);
			if (!frm.doc.paid_to) frm.set_value("paid_to_account_currency", null);
		}
	},

	setup: function(frm) {
		var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";

		frm.set_query("paid_from", function() {
			var account_types = in_list(["Pay", "Internal Transfer"], frm.doc.payment_type) ?
				["Bank", "Cash"] : party_account_type;

			return {
				filters: {
					"account_type": ["in", account_types],
					"is_group": 0,
					"company": frm.doc.company
				}
			}
		});

		frm.set_query("party_type", function() {
			return{
				"filters": {
					"name": ["in",["Customer","Supplier"]],
				}
			}
		});

		frm.set_query("paid_to", function() {
			var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ?
	 			["Bank", "Cash"] : party_account_type;

			return {
				filters: {
					"account_type": ["in", account_types],
					"is_group": 0,
					"company": frm.doc.company
				}
			}
		});

		frm.set_query("account", "deductions", function() {
			return {
				filters: {<commit_msg>[Fix] Payment entry account Paid To Show receivable accounts for supplier<commit_after>// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
{% include "erpnext/public/js/controllers/accounts.js" %}

frappe.ui.form.on('Payment Entry', {
	onload: function(frm) {
		if(frm.doc.__islocal) {
			if (!frm.doc.paid_from) frm.set_value("paid_from_account_currency", null);
			if (!frm.doc.paid_to) frm.set_value("paid_to_account_currency", null);
		}
	},

	setup: function(frm) {
		frm.set_query("paid_from", function() {
			var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";
			var account_types = in_list(["Pay", "Internal Transfer"], frm.doc.payment_type) ?
				["Bank", "Cash"] : party_account_type;

			return {
				filters: {
					"account_type": ["in", account_types],
					"is_group": 0,
					"company": frm.doc.company
				}
			}
		});

		frm.set_query("party_type", function() {
			return{
				"filters": {
					"name": ["in",["Customer","Supplier"]],
				}
			}
		});

		frm.set_query("paid_to", function() {
			var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";
			var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ?
	 			["Bank", "Cash"] : party_account_type;

			return {
				filters: {
					"account_type": ["in", account_types],
					"is_group": 0,
					"company": frm.doc.company
				}
			}
		});

		frm.set_query("account", "deductions", function() {
			return {
				filters: {
{'fraction_non_alphanumeric': 0.17347283158960514, 'fraction_numerical': 0.004049949375632805, 'mean_word_length': 3.765273311897106, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4819859', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1061, 'n_words': 193}