diff --git a/check_run/check_run/custom/bank_account.json b/check_run/check_run/custom/bank_account.json index 5633922e..1a3d5cab 100644 --- a/check_run/check_run/custom/bank_account.json +++ b/check_run/check_run/custom/bank_account.json @@ -1,129 +1,192 @@ { - "custom_fields": [ - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2022-06-30 11:20:02.666689", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Bank Account", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "check_number", - "fieldtype": "Data", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "idx": 10, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "company", - "label": "Last Used Check Number", - "length": 0, - "mandatory_depends_on": null, - "modified": "2022-06-30 11:20:02.666689", - "module": "Check Run", - "modified_by": "Administrator", - "name": "Bank Account-check_number", - "no_copy": 0, - "non_negative": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 1, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2022-08-07 14:55:42.859002", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Bank Account", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "company_ach_id", - "fieldtype": "Data", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "idx": 10, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "check_number", - "label": "Company ACH ID", - "length": 0, - "mandatory_depends_on": null, - "modified": "2022-08-07 14:55:42.859002", - "modified_by": "Administrator", - "name": "Bank Account-company_ach_id", - "no_copy": 0, - "non_negative": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 1, - "unique": 0, - "width": null - } - ], - "custom_perms": [], - "doctype": "Bank Account", - "property_setters": [], - "sync_on_migrate": 1 -} + "custom_fields": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2022-06-30 11:20:02.666689", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Bank Account", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "check_number", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 11, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "company", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Last Used Check Number", + "length": 0, + "mandatory_depends_on": null, + "modified": "2022-06-30 11:20:02.666689", + "modified_by": "Administrator", + "module": "Check Run", + "name": "Bank Account-check_number", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2022-08-07 14:55:42.859002", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Bank Account", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "company_ach_id", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 12, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "check_number", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Company ACH ID", + "length": 0, + "mandatory_depends_on": null, + "modified": "2022-08-07 14:55:42.859002", + "modified_by": "Administrator", + "module": null, + "name": "Bank Account-company_ach_id", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2023-10-11 15:03:16.705933", + "default": "1", + "depends_on": null, + "description": "Allow Quick Check Payment Entries to be made against this Bank Account. This fetches the Bank Account into the Payment Entry automatically.", + "docstatus": 0, + "dt": "Bank Account", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "allow_quick_check", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 8, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "is_company_account", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Allow Quick Check", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-10-11 15:22:30.742925", + "modified_by": "Administrator", + "module": "Check Run", + "name": "Bank Account-allow_quick_check", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + } + ], + "custom_perms": [], + "doctype": "Bank Account", + "links": [], + "property_setters": [], + "sync_on_migrate": 1 +} \ No newline at end of file diff --git a/check_run/check_run/custom/payment_entry.json b/check_run/check_run/custom/payment_entry.json index 3df21d4b..ffdad62a 100644 --- a/check_run/check_run/custom/payment_entry.json +++ b/check_run/check_run/custom/payment_entry.json @@ -1,69 +1,94 @@ { - "custom_fields": [ - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2022-06-30 15:30:29.886371", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Payment Entry", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "check_run", - "fieldtype": "Data", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "idx": 5, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "payment_order_status", - "label": "Check Run", - "length": 0, - "mandatory_depends_on": null, - "modified": "2022-06-30 11:20:02.666689", - "modified_by": "Administrator", - "module": "Check Run", - "name": "Payment Entry-check_run", - "no_copy": 0, - "non_negative": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - } - ], - "custom_perms": [], - "doctype": "Payment Entry", - "property_setters": [], - "sync_on_migrate": 1 -} + "custom_fields": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2022-06-30 15:30:29.886371", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Payment Entry", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "check_run", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 5, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "payment_order_status", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Check Run", + "length": 0, + "mandatory_depends_on": null, + "modified": "2022-06-30 11:20:02.666689", + "modified_by": "Administrator", + "module": "Check Run", + "name": "Payment Entry-check_run", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + } + ], + "custom_perms": [], + "doctype": "Payment Entry", + "links": [], + "property_setters": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2023-10-11 14:35:49.611822", + "default_value": null, + "doc_type": "Payment Entry", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "references", + "idx": 0, + "is_system_generated": 0, + "modified": "2023-10-11 14:35:49.611822", + "modified_by": "Administrator", + "module": "Check Run", + "name": "Payment Entry-references-mandatory_depends_on", + "owner": "Administrator", + "property": "mandatory_depends_on", + "property_type": "Data", + "row_name": null, + "value": "eval: doc.payment_type != 'Internal Transfer'" + } + ], + "sync_on_migrate": 1 +} \ No newline at end of file diff --git a/check_run/check_run/doctype/check_run_settings/check_run_settings.js b/check_run/check_run/doctype/check_run_settings/check_run_settings.js index 6d32d395..792b9c3e 100644 --- a/check_run/check_run/doctype/check_run_settings/check_run_settings.js +++ b/check_run/check_run/doctype/check_run_settings/check_run_settings.js @@ -2,6 +2,22 @@ // For license information, please see license.txt frappe.ui.form.on('Check Run Settings', { - // refresh: function(frm) { - // } + refresh: frm => { + frm.set_query('pay_to_account', () => { + return { + filters: { + company: frm.doc.company, + account_type: 'Payable', + }, + } + }) + frm.set_query('bank_account', () => { + return { + filters: { + is_company_account: 1, + company: frm.doc.company, + }, + } + }) + }, }) diff --git a/check_run/public/js/check_run/check_run_quick_entry.js b/check_run/public/js/check_run/check_run_quick_entry.js index 88361a5c..b85d2b2a 100644 --- a/check_run/public/js/check_run/check_run_quick_entry.js +++ b/check_run/public/js/check_run/check_run_quick_entry.js @@ -11,6 +11,7 @@ frappe.ui.form.CheckRunQuickEntryForm = class CheckRunQuickEntryForm extends fra this.dialog.fields_dict['bank_account'].get_query = () => { return { filters: { + is_company_account: 1, company: this.dialog.get_field('company').value, }, } diff --git a/check_run/public/js/custom/payment_entry_custom.js b/check_run/public/js/custom/payment_entry_custom.js index 93109291..a483229e 100644 --- a/check_run/public/js/custom/payment_entry_custom.js +++ b/check_run/public/js/custom/payment_entry_custom.js @@ -5,13 +5,13 @@ frappe.ui.form.on('Payment Entry', { bank_account: frm => { get_next_check_number(frm) }, + onload: frm => { + load_supplier_default_mode_of_payment(frm) + }, }) function get_next_check_number(frm) { - if (!frm.doc.bank_account) { - return - } - if (!frm.doc.mode_of_payment) { + if (!(frm.doc.bank_account || frm.doc.mode_of_payment)) { return } frappe.db.get_value('Bank Account', frm.doc.bank_account, 'check_number').then(r => { @@ -19,3 +19,27 @@ function get_next_check_number(frm) { frm.set_value('reference_no', check_number) }) } + +function load_supplier_default_mode_of_payment(frm) { + if (!(frm.is_new() || frm.doc.dostatus == 0 || frm.doc.party_type != 'Supplier')) { + return + } + frappe.db + .get_value('Supplier', frm.doc.party, 'supplier_default_mode_of_payment') + .then(async r => { + frm.set_value('mode_of_payment', r.message.supplier_default_mode_of_payment) + }) + .then(() => { + frappe.db + .get_list( + 'Bank Account', + { filters: { is_company_account: 1, allow_quick_check: 1, account: frm.doc.paid_from } }, + 'name' + ) + .then(r => { + if (r.length) { + frm.set_value('bank_account', r[0].name) + } + }) + }) +} diff --git a/docs/assets/BankAccount.png b/docs/assets/BankAccount.png new file mode 100644 index 00000000..8141b826 Binary files /dev/null and b/docs/assets/BankAccount.png differ diff --git a/docs/index.md b/docs/index.md index 01382f16..56f0dd6f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -51,6 +51,7 @@ Individual payment entries are linked with a Check Run. You can set the number o Follow the links below for more information about Check Run's features: +- [Quick Check / Payment Entry Customizations](./payment_entry.md) - [ACH Generation](./achgeneration.md) - [Render PDF Sequence](./renderpdfsequence.md) - [Positive Pay Report](./positivepay.md) diff --git a/docs/payment_entry.md b/docs/payment_entry.md new file mode 100644 index 00000000..de44be31 --- /dev/null +++ b/docs/payment_entry.md @@ -0,0 +1,11 @@ +# Payment Entry +## Auto-Increment Check Number +The Check Run application will automatically fetch and increment check numbers, the latest number is stored in the Bank Account doctype. Both Mode of Payment and Company Bank Account are required fields to fetch the data. As long as the number provided is an integer it will save it to the linked Bank Account record. + +## Quick Check +This setting on Bank Account automatically fetches the Bank Account into the Payment Entry. This allows for paying a single Purchase Invoice with the normal Create => Payment workflow without selecting any additional information. + +![Screen shot showing Bank Account Settings](./assets/BankAccount.png) + +## Additional Customizations +Check Run takes the opinion that there is no scenario where it it appropriate to cut a check without providing a reference document. Payment References has been customized to be required unless the Payment Entry is of type 'Internal Transfer'.