From db8500c03af758f7640e78580efcaa66bc2fedd4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 6 Mar 2019 18:18:21 +0530 Subject: [PATCH] POS profile, account for change amount must be cash or bank account --- erpnext/accounts/doctype/pos_profile/pos_profile.js | 8 ++++++++ .../accounts/doctype/sales_invoice/sales_invoice.js | 8 ++++++++ .../sales_invoice_payment/sales_invoice_payment.json | 12 ++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js index 13d53d1f6a..a6386ddc4b 100755 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.js +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js @@ -33,6 +33,14 @@ frappe.ui.form.on('POS Profile', { }; }); + frm.set_query("account_for_change_amount", function() { + return { + filters: { + account_type: ['in', ["Cash", "Bank"]] + } + }; + }); + frm.set_query("print_format", function() { return { filters: { doc_type: "Sales Invoice", print_format_type: "Js"} }; }); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index b1a851a4f1..3816632065 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -556,6 +556,14 @@ frappe.ui.form.on('Sales Invoice', { frm.add_fetch('payment_term', 'invoice_portion', 'invoice_portion'); frm.add_fetch('payment_term', 'description', 'description'); + frm.set_query("account_for_change_amount", function() { + return { + filters: { + account_type: ['in', ["Cash", "Bank"]] + } + }; + }); + frm.custom_make_buttons = { 'Delivery Note': 'Delivery', 'Sales Invoice': 'Sales Return', diff --git a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json index ccdabfe544..1c5962acf6 100644 --- a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json +++ b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json @@ -20,6 +20,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:parent.doctype == 'POS Profile'", + "fetch_if_empty": 0, "fieldname": "default", "fieldtype": "Check", "hidden": 0, @@ -52,6 +53,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "mode_of_payment", "fieldtype": "Link", "hidden": 0, @@ -85,8 +87,9 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "", + "default": "0", "depends_on": "eval:parent.doctype == 'Sales Invoice'", + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -120,6 +123,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_3", "fieldtype": "Column Break", "hidden": 0, @@ -151,6 +155,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "account", "fieldtype": "Link", "hidden": 0, @@ -185,6 +190,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "mode_of_payment.type", + "fetch_if_empty": 0, "fieldname": "type", "fieldtype": "Read Only", "hidden": 0, @@ -218,6 +224,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_amount", "fieldtype": "Currency", "hidden": 0, @@ -251,6 +258,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "clearance_date", "fieldtype": "Date", "hidden": 0, @@ -287,7 +295,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-02-18 15:03:59.720469", + "modified": "2019-03-06 15:58:37.839241", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Payment",