diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index 5fa43ae62850..55215982add1 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -2200,7 +2200,11 @@ def create_supplier(**args): args = frappe._dict(args) if frappe.db.exists("Supplier", args.supplier_name): - return frappe.get_doc("Supplier", args.supplier_name) + doc = frappe.get_doc("Supplier", args.supplier_name) + if doc.name == "_Test Supplier USD" and not frappe.db.exists("Party Account", {"parent": doc.name, "account": "_Test Payable USD - _TC"}): + doc.append("accounts", {"company": args.company, "account": "_Test Payable USD - _TC"}) + frappe.db.commit() + return doc doc = frappe.get_doc( { "doctype": "Supplier", @@ -2215,12 +2219,11 @@ def create_supplier(**args): 'company': args.company, 'account': '_Test Payable USD - _TC' if args.default_currency == 'USD' else '_Test TDS Payable - _TC', }) - if not args.without_supplier_group: doc.supplier_group = args.supplier_group or "Services" + - doc.insert() - doc.save() + doc.insert(ignore_mandatory=True) frappe.db.commit() return doc @@ -2260,7 +2263,7 @@ def create_account(): if account["parent"]: doc.parent_account = account["parent"] - + doc.insert(ignore_mandatory=True) frappe.db.commit() @@ -2295,40 +2298,50 @@ def create_records(supplier): def make_test_item(item_name=None): - from erpnext.stock.doctype.item.test_item import make_item + from erpnext.stock.doctype.item.test_item import make_item + app_name = "india_compliance" + if not frappe.db.exists("Item", item_name or "Test Item with Tax"): + if app_name in frappe.get_installed_apps(): + if not frappe.db.exists("GST HSN Code", '888890'): + frappe.get_doc({ + "doctype": 'GST HSN Code', + "hsn_code": '888890', + "description": 'test' + }).insert() + frappe.db.commit() + + item= make_item( + item_name or "Test Item with Tax", + { + "is_stock_item": 1, + "gst_hsn_code": "888890", + }, + ) + + return item - if not frappe.db.exists("Item", item_name or "Test Item with Tax"): - app_name = "india_compliance" - - if app_name in frappe.get_installed_apps(): - if not frappe.db.exists("GST HSN Code", '888890'): - frappe.get_doc({ - "doctype": 'GST HSN Code', - "hsn_code": '888890', - "description": 'test' - }).insert() - frappe.db.commit() - - item= make_item( - item_name or "Test Item with Tax", - { - "is_stock_item": 1, - "gst_hsn_code": "888890", - }, - ) - - return item - - else: - item= make_item( - "Test TDS Item", - { - "is_stock_item": 1, - }, - ) - return item - else: - return frappe.get_doc("Item", item_name or "Test Item with Tax") + else: + item= make_item( + "Test TDS Item", + { + "is_stock_item": 1, + }, + ) + return item + else: + if app_name in frappe.get_installed_apps(): + if not frappe.db.exists("GST HSN Code", '888890'): + frappe.get_doc({ + "doctype": 'GST HSN Code', + "hsn_code": '888890', + "description": 'test' + }).insert() + item=frappe.get_doc("Item", item_name or "Test Item with Tax") + if not item.gst_hsn_code: + item.gst_hsn_code="888890" + item.save() + frappe.db.commit() + return item def create_purchase_invoice(**args): # return sales invoice doc object diff --git a/erpnext/accounts/doctype/payment_request/payment_request.js b/erpnext/accounts/doctype/payment_request/payment_request.js index 50f96a4e2b6b..b5b61a23f09b 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.js +++ b/erpnext/accounts/doctype/payment_request/payment_request.js @@ -93,3 +93,7 @@ frappe.ui.form.on("Payment Request", "is_a_subscription", function (frm) { }); } }); + +frappe.ui.form.on("Payment Request", "is_payment_order_required", function (frm) { + frm.toggle_reqd("bank_account", frm.doc.is_payment_order_required); +}) \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json index db7c16bdd087..dd8bde0b4a7d 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.json +++ b/erpnext/accounts/doctype/payment_request/payment_request.json @@ -1,480 +1,477 @@ { - "actions": [], - "autoname": "naming_series:", - "creation": "2015-12-15 22:23:24.745065", - "doctype": "DocType", - "engine": "InnoDB", - "field_order": [ - "payment_request_type", - "transaction_date", - "column_break_2", - "naming_series", - "company", - "mode_of_payment", - "party_details", - "party_type", - "party", - "party_name", - "column_break_4", - "reference_doctype", - "reference_name", - "transaction_details", - "grand_total", - "currency", - "is_a_subscription", - "column_break_18", - "outstanding_amount", - "party_account_currency", - "subscription_section", - "subscription_plans", - "bank_account_details", - "bank_account", - "bank", - "column_break_11", - "iban", - "branch_code", - "swift_number", - "accounting_dimensions_section", - "cost_center", - "dimension_col_break", - "recipient_and_message", - "print_format", - "email_to", - "subject", - "column_break_9", - "payment_gateway_account", - "status", - "make_sales_invoice", - "section_break_10", - "message", - "message_examples", - "mute_email", - "payment_url", - "section_break_7", - "payment_gateway", - "payment_account", - "payment_channel", - "payment_order", - "amended_from", - "column_break_iiuv", - "phone_number" - ], - "fields": [ - { - "default": "Inward", - "fieldname": "payment_request_type", - "fieldtype": "Select", - "label": "Payment Request Type", - "options": "Outward\nInward", - "reqd": 1 - }, - { - "fieldname": "transaction_date", - "fieldtype": "Date", - "in_preview": 1, - "label": "Transaction Date" - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "naming_series", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Series", - "no_copy": 1, - "options": "ACC-PRQ-.YYYY.-", - "print_hide": 1, - "reqd": 1, - "set_only_once": 1 - }, - { - "fieldname": "mode_of_payment", - "fieldtype": "Link", - "label": "Mode of Payment", - "options": "Mode of Payment" - }, - { - "fieldname": "party_details", - "fieldtype": "Section Break", - "label": "Party Details" - }, - { - "fieldname": "party_type", - "fieldtype": "Link", - "label": "Party Type", - "options": "DocType" - }, - { - "fieldname": "party", - "fieldtype": "Dynamic Link", - "label": "Party", - "options": "party_type" - }, - { - "fieldname": "column_break_4", - "fieldtype": "Column Break" - }, - { - "fieldname": "reference_doctype", - "fieldtype": "Link", - "in_standard_filter": 1, - "label": "Reference Doctype", - "no_copy": 1, - "options": "DocType", - "print_hide": 1, - "read_only": 1, - "report_hide": 1 - }, - { - "fieldname": "reference_name", - "fieldtype": "Dynamic Link", - "in_global_search": 1, - "in_standard_filter": 1, - "label": "Reference Name", - "no_copy": 1, - "options": "reference_doctype", - "print_hide": 1, - "read_only": 1, - "search_index": 1 - }, - { - "fieldname": "transaction_details", - "fieldtype": "Section Break", - "label": "Transaction Details" - }, - { - "description": "Amount in transaction currency", - "fieldname": "grand_total", - "fieldtype": "Currency", - "in_preview": 1, - "label": "Amount", - "non_negative": 1, - "options": "currency", - "reqd": 1 - }, - { - "default": "0", - "fieldname": "is_a_subscription", - "fieldtype": "Check", - "label": "Is a Subscription" - }, - { - "fieldname": "column_break_18", - "fieldtype": "Column Break" - }, - { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Transaction Currency", - "options": "Currency", - "read_only": 1 - }, - { - "depends_on": "eval:doc.is_a_subscription", - "fieldname": "subscription_section", - "fieldtype": "Section Break", - "label": "Subscription Section" - }, - { - "fieldname": "subscription_plans", - "fieldtype": "Table", - "label": "Subscription Plans", - "options": "Subscription Plan Detail" - }, - { - "collapsible": 1, - "fieldname": "bank_account_details", - "fieldtype": "Section Break", - "label": "Bank Account Details" - }, - { - "fieldname": "bank_account", - "fieldtype": "Link", - "label": "Bank Account", - "options": "Bank Account" - }, - { - "fetch_from": "bank_account.bank", - "fieldname": "bank", - "fieldtype": "Link", - "label": "Bank", - "options": "Bank", - "read_only": 1 - }, - { - "fetch_from": "bank_account.bank_account_no", - "fieldname": "bank_account_no", - "fieldtype": "Read Only", - "label": "Bank Account No" - }, - { - "fetch_from": "bank_account.account", - "fieldname": "account", - "fieldtype": "Read Only", - "label": "Account" - }, - { - "fieldname": "column_break_11", - "fieldtype": "Column Break" - }, - { - "fetch_from": "bank_account.iban", - "fieldname": "iban", - "fieldtype": "Read Only", - "label": "IBAN" - }, - { - "fetch_from": "bank_account.branch_code", - "fetch_if_empty": 1, - "fieldname": "branch_code", - "fieldtype": "Read Only", - "label": "Branch Code" - }, - { - "fetch_from": "bank.swift_number", - "fieldname": "swift_number", - "fieldtype": "Read Only", - "label": "SWIFT Number" - }, - { - "collapsible": 1, - "fieldname": "accounting_dimensions_section", - "fieldtype": "Section Break", - "label": "Accounting Dimensions" - }, - { - "fieldname": "cost_center", - "fieldtype": "Link", - "label": "Cost Center", - "options": "Cost Center" - }, - { - "fieldname": "dimension_col_break", - "fieldtype": "Column Break" - }, - { - "depends_on": "eval: doc.payment_request_type == 'Inward'", - "fieldname": "recipient_and_message", - "fieldtype": "Section Break", - "label": "Recipient Message And Payment Details" - }, - { - "depends_on": "eval: doc.payment_channel != \"Phone\"", - "fieldname": "print_format", - "fieldtype": "Select", - "label": "Print Format" - }, - { - "fieldname": "email_to", - "fieldtype": "Data", - "in_global_search": 1, - "label": "To" - }, - { - "depends_on": "eval: doc.payment_channel != \"Phone\"", - "fieldname": "subject", - "fieldtype": "Data", - "in_global_search": 1, - "label": "Subject" - }, - { - "fieldname": "column_break_9", - "fieldtype": "Column Break" - }, - { - "depends_on": "eval: doc.payment_request_type == 'Inward'", - "fieldname": "payment_gateway_account", - "fieldtype": "Link", - "label": "Payment Gateway Account", - "options": "Payment Gateway Account" - }, - { - "default": "Draft", - "fieldname": "status", - "fieldtype": "Select", - "hidden": 1, - "in_standard_filter": 1, - "label": "Status", - "options": "\nDraft\nRequested\nInitiated\nPartially Paid\nPayment Ordered\nPaid\nFailed\nCancelled", - "read_only": 1 - }, - { - "default": "0", - "depends_on": "eval:doc.reference_doctype==\"Sales Order\"", - "fieldname": "make_sales_invoice", - "fieldtype": "Check", - "hidden": 1, - "label": "Make Sales Invoice", - "read_only": 1 - }, - { - "depends_on": "eval: doc.payment_request_type == 'Inward' || doc.payment_channel != \"Phone\"", - "fieldname": "section_break_10", - "fieldtype": "Section Break" - }, - { - "depends_on": "eval: doc.payment_channel != \"Phone\"", - "fieldname": "message", - "fieldtype": "Text", - "label": "Message" - }, - { - "depends_on": "eval: doc.payment_channel != \"Phone\"", - "fieldname": "message_examples", - "fieldtype": "HTML", - "label": "Message Examples", - "options": "
Message Example
\n\n<p>Dear {{ doc.contact_person }},</p>\n\n<p>Requesting payment for {{ doc.doctype }}, {{ doc.name }} for {{ doc.grand_total }}.</p>\n\n<a href=\"{{ payment_url }}\"> click here to pay </a>\n\n
\n", - "print_hide": 1 - }, - { - "default": "0", - "fieldname": "mute_email", - "fieldtype": "Check", - "hidden": 1, - "label": "Mute Email", - "no_copy": 1, - "print_hide": 1, - "read_only": 1, - "report_hide": 1 - }, - { - "fieldname": "payment_url", - "fieldtype": "Data", - "hidden": 1, - "length": 500, - "options": "URL", - "read_only": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "doc.payment_gateway_account", - "depends_on": "eval: doc.payment_request_type == 'Inward'", - "fieldname": "section_break_7", - "fieldtype": "Section Break", - "label": "Payment Gateway Details" - }, - { - "fetch_from": "payment_gateway_account.payment_gateway", - "fieldname": "payment_gateway", - "fieldtype": "Read Only", - "label": "Payment Gateway" - }, - { - "fetch_from": "payment_gateway_account.payment_account", - "fieldname": "payment_account", - "fieldtype": "Read Only", - "label": "Payment Account", - "read_only": 1 - }, - { - "depends_on": "eval: doc.payment_channel==\"Phone\"", + "actions": [], + "autoname": "naming_series:", + "creation": "2015-12-15 22:23:24.745065", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "payment_request_type", + "transaction_date", + "is_payment_order_required", + "column_break_2", + "naming_series", + "company", + "mode_of_payment", + "party_details", + "party_type", + "party", + "party_name", + "column_break_4", + "reference_doctype", + "reference_name", + "transaction_details", + "grand_total", + "currency", + "is_a_subscription", + "column_break_18", + "outstanding_amount", + "party_account_currency", + "subscription_section", + "subscription_plans", + "bank_account_details", + "bank_account", + "bank", + "column_break_11", + "iban", + "branch_code", + "swift_number", + "accounting_dimensions_section", + "cost_center", + "dimension_col_break", + "recipient_and_message", + "print_format", + "email_to", + "subject", + "column_break_9", + "payment_gateway_account", + "status", + "make_sales_invoice", + "section_break_10", + "message", + "message_examples", + "mute_email", + "payment_url", + "section_break_7", + "payment_gateway", + "payment_account", + "payment_channel", + "payment_order", + "amended_from", + "bank_account_no", + "account" + ], + "fields": [ + { + "default": "Inward", + "fieldname": "payment_request_type", + "fieldtype": "Select", + "label": "Payment Request Type", + "options": "Outward\nInward", + "reqd": 1 + }, + { + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_preview": 1, + "label": "Transaction Date" + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Series", + "no_copy": 1, + "options": "ACC-PRQ-.YYYY.-", + "print_hide": 1, + "reqd": 1, + "set_only_once": 1 + }, + { + "fieldname": "mode_of_payment", + "fieldtype": "Link", + "label": "Mode of Payment", + "options": "Mode of Payment" + }, + { + "fieldname": "party_details", + "fieldtype": "Section Break", + "label": "Party Details" + }, + { + "fieldname": "party_type", + "fieldtype": "Link", + "label": "Party Type", + "options": "DocType" + }, + { + "fieldname": "party", + "fieldtype": "Dynamic Link", + "label": "Party", + "options": "party_type" + }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, + { + "fieldname": "reference_doctype", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Reference Doctype", + "no_copy": 1, + "options": "DocType", + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + }, + { + "fieldname": "reference_name", + "fieldtype": "Dynamic Link", + "in_global_search": 1, + "in_standard_filter": 1, + "label": "Reference Name", + "no_copy": 1, + "options": "reference_doctype", + "print_hide": 1, + "read_only": 1, + "search_index": 1 + }, + { + "fieldname": "transaction_details", + "fieldtype": "Section Break", + "label": "Transaction Details" + }, + { + "description": "Amount in transaction currency", + "fieldname": "grand_total", + "fieldtype": "Currency", + "in_preview": 1, + "label": "Amount", + "non_negative": 1, + "options": "currency", + "reqd": 1 + }, + { + "default": "0", + "fieldname": "is_a_subscription", + "fieldtype": "Check", + "label": "Is a Subscription" + }, + { + "fieldname": "column_break_18", + "fieldtype": "Column Break" + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "label": "Transaction Currency", + "options": "Currency", + "read_only": 1 + }, + { + "depends_on": "eval:doc.is_a_subscription", + "fieldname": "subscription_section", + "fieldtype": "Section Break", + "label": "Subscription Section" + }, + { + "fieldname": "subscription_plans", + "fieldtype": "Table", + "label": "Subscription Plans", + "options": "Subscription Plan Detail" + }, + { + "collapsible": 1, + "fieldname": "bank_account_details", + "fieldtype": "Section Break", + "label": "Bank Account Details" + }, + { + "fieldname": "bank_account", + "fieldtype": "Link", + "label": "Bank Account", + "options": "Bank Account" + }, + { + "fetch_from": "bank_account.bank", + "fieldname": "bank", + "fieldtype": "Link", + "label": "Bank", + "options": "Bank", + "read_only": 1 + }, + { + "fetch_from": "bank_account.bank_account_no", + "fieldname": "bank_account_no", + "fieldtype": "Read Only", + "label": "Bank Account No" + }, + { + "fetch_from": "bank_account.account", + "fieldname": "account", + "fieldtype": "Read Only", + "label": "Account" + }, + { + "fieldname": "column_break_11", + "fieldtype": "Column Break" + }, + { + "fetch_from": "bank_account.iban", + "fieldname": "iban", + "fieldtype": "Read Only", + "label": "IBAN" + }, + { + "fetch_from": "bank_account.branch_code", + "fetch_if_empty": 1, + "fieldname": "branch_code", + "fieldtype": "Read Only", + "label": "Branch Code" + }, + { + "fetch_from": "bank.swift_number", + "fieldname": "swift_number", + "fieldtype": "Read Only", + "label": "SWIFT Number" + }, + { + "collapsible": 1, + "fieldname": "accounting_dimensions_section", + "fieldtype": "Section Break", + "label": "Accounting Dimensions" + }, + { + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center" + }, + { + "fieldname": "dimension_col_break", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval: doc.payment_request_type == 'Inward'", + "fieldname": "recipient_and_message", + "fieldtype": "Section Break", + "label": "Recipient Message And Payment Details" + }, + { + "depends_on": "eval: doc.payment_channel != \"Phone\"", + "fieldname": "print_format", + "fieldtype": "Select", + "label": "Print Format" + }, + { + "fieldname": "email_to", + "fieldtype": "Data", + "in_global_search": 1, + "label": "To" + }, + { + "depends_on": "eval: doc.payment_channel != \"Phone\"", + "fieldname": "subject", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Subject" + }, + { + "fieldname": "column_break_9", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval: doc.payment_request_type == 'Inward'", + "fieldname": "payment_gateway_account", + "fieldtype": "Link", + "label": "Payment Gateway Account", + "options": "Payment Gateway Account" + }, + { + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "hidden": 1, + "in_standard_filter": 1, + "label": "Status", + "options": "\nDraft\nRequested\nInitiated\nPartially Paid\nPayment Ordered\nPaid\nFailed\nCancelled", + "read_only": 1 + }, + { + "default": "0", + "depends_on": "eval:doc.reference_doctype==\"Sales Order\"", + "fieldname": "make_sales_invoice", + "fieldtype": "Check", + "hidden": 1, + "label": "Make Sales Invoice", + "read_only": 1 + }, + { + "depends_on": "eval: doc.payment_request_type == 'Inward' || doc.payment_channel != \"Phone\"", + "fieldname": "section_break_10", + "fieldtype": "Section Break" + }, + { + "depends_on": "eval: doc.payment_channel != \"Phone\"", + "fieldname": "message", + "fieldtype": "Text", + "label": "Message" + }, + { + "depends_on": "eval: doc.payment_channel != \"Phone\"", + "fieldname": "message_examples", + "fieldtype": "HTML", + "label": "Message Examples", + "options": "
Message Example
\n\n<p>Dear {{ doc.contact_person }},</p>\n\n<p>Requesting payment for {{ doc.doctype }}, {{ doc.name }} for {{ doc.grand_total }}.</p>\n\n<a href=\"{{ payment_url }}\"> click here to pay </a>\n\n
\n", + "print_hide": 1 + }, + { + "default": "0", + "fieldname": "mute_email", + "fieldtype": "Check", + "hidden": 1, + "label": "Mute Email", + "no_copy": 1, + "print_hide": 1, + "read_only": 1, + "report_hide": 1 + }, + { + "fieldname": "payment_url", + "fieldtype": "Data", + "hidden": 1, + "length": 500, + "options": "URL", + "read_only": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "doc.payment_gateway_account", + "depends_on": "eval: doc.payment_request_type == 'Inward'", + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "label": "Payment Gateway Details" + }, + { + "fetch_from": "payment_gateway_account.payment_gateway", + "fieldname": "payment_gateway", + "fieldtype": "Read Only", + "label": "Payment Gateway" + }, + { + "fetch_from": "payment_gateway_account.payment_account", + "fieldname": "payment_account", + "fieldtype": "Read Only", + "label": "Payment Account", + "read_only": 1 + }, + { "fetch_from": "payment_gateway_account.payment_channel", - "fieldname": "payment_channel", - "fieldtype": "Select", - "label": "Payment Channel", - "options": "\nEmail\nPhone", - "read_only": 1 - }, - { - "fieldname": "payment_order", - "fieldtype": "Link", - "label": "Payment Order", - "options": "Payment Order", - "read_only": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Payment Request", - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "eval: doc.docstatus === 1", - "description": "Amount in party's bank account currency", - "fieldname": "outstanding_amount", - "fieldtype": "Currency", - "in_preview": 1, - "label": "Outstanding Amount", - "non_negative": 1, - "options": "party_account_currency", - "read_only": 1 - }, - { - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "options": "Company", - "read_only": 1 - }, - { - "fieldname": "party_account_currency", - "fieldtype": "Link", - "label": "Party Account Currency", - "options": "Currency", - "read_only": 1 - }, - { - "fieldname": "party_name", - "fieldtype": "Data", - "label": "Party Name", - "read_only": 1 - }, - { - "fieldname": "column_break_iiuv", - "fieldtype": "Column Break" - }, - { - "fieldname": "phone_number", - "fieldtype": "Data", - "label": "Phone Number" - } - ], - "in_create": 1, - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2024-12-27 21:29:10.361894", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Payment Request", - "naming_rule": "By \"Naming Series\" field", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "share": 1, - "write": 1 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "share": 1, - "submit": 1, - "write": 1 - } - ], - "show_preview_popup": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} + "fieldname": "payment_channel", + "fieldtype": "Select", + "label": "Payment Channel", + "options": "\nEmail\nPhone", + "read_only": 1 + }, + { + "fieldname": "payment_order", + "fieldtype": "Link", + "label": "Payment Order", + "options": "Payment Order", + "read_only": 1 + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Payment Request", + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "eval: doc.docstatus === 1", + "description": "Amount in party's bank account currency", + "fieldname": "outstanding_amount", + "fieldtype": "Currency", + "in_preview": 1, + "label": "Outstanding Amount", + "non_negative": 1, + "options": "party_account_currency", + "read_only": 1 + }, + { + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "read_only": 1 + }, + { + "fieldname": "party_account_currency", + "fieldtype": "Link", + "label": "Party Account Currency", + "options": "Currency", + "read_only": 1 + }, + { + "fieldname": "party_name", + "fieldtype": "Data", + "label": "Party Name", + "read_only": 1 + }, + { + "default": "0", + "fieldname": "is_payment_order_required", + "fieldtype": "Check", + "label": "Is Payment Order Required" + } + ], + "in_create": 1, + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2025-01-14 17:29:21.046587", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Payment Request", + "naming_rule": "By \"Naming Series\" field", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "share": 1, + "write": 1 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "submit": 1, + "write": 1 + } + ], + "show_preview_popup": 1, + "sort_field": "modified", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index e31579a40f52..d094e482db2e 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -35,12 +35,9 @@ class PaymentRequest(Document): from typing import TYPE_CHECKING if TYPE_CHECKING: + from erpnext.accounts.doctype.subscription_plan_detail.subscription_plan_detail import SubscriptionPlanDetail from frappe.types import DF - from erpnext.accounts.doctype.subscription_plan_detail.subscription_plan_detail import ( - SubscriptionPlanDetail, - ) - account: DF.ReadOnly | None amended_from: DF.Link | None bank: DF.Link | None @@ -54,6 +51,7 @@ class PaymentRequest(Document): grand_total: DF.Currency iban: DF.ReadOnly | None is_a_subscription: DF.Check + is_payment_order_required: DF.Check make_sales_invoice: DF.Check message: DF.Text | None mode_of_payment: DF.Link | None @@ -65,7 +63,7 @@ class PaymentRequest(Document): party_name: DF.Data | None party_type: DF.Link | None payment_account: DF.ReadOnly | None - payment_channel: DF.Literal["", "Email", "Phone", "Other"] + payment_channel: DF.Literal["", "Email", "Phone"] payment_gateway: DF.ReadOnly | None payment_gateway_account: DF.Link | None payment_order: DF.Link | None @@ -74,17 +72,7 @@ class PaymentRequest(Document): print_format: DF.Literal[None] reference_doctype: DF.Link | None reference_name: DF.DynamicLink | None - status: DF.Literal[ - "", - "Draft", - "Requested", - "Initiated", - "Partially Paid", - "Payment Ordered", - "Paid", - "Failed", - "Cancelled", - ] + status: DF.Literal["", "Draft", "Requested", "Initiated", "Partially Paid", "Payment Ordered", "Paid", "Failed", "Cancelled"] subject: DF.Data | None subscription_plans: DF.Table[SubscriptionPlanDetail] swift_number: DF.ReadOnly | None diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 2ebf9528f295..7793ddbd2e3d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -2468,16 +2468,35 @@ def test_tax_withholding_with_supplier_TC_ACC_023(self): pi.tax_withholding_category="Test - TDS - 194C - Company" pi.save() pi.submit() - - expected_result=[ - ['Creditors - _TC', 0.0, 90000.0, pi.posting_date], - ['Creditors - _TC', 1800.0, 0.0, pi.posting_date], - ['Stock Received But Not Billed - _TC', 90000.0, 0.0, pi.posting_date], - ['_Test TDS Payable - _TC', 0.0, 1800.0, pi.posting_date] - ] - - check_gl_entries(self,voucher_no=pi.name,expected_gle=expected_result,posting_date=pi.posting_date,voucher_type="Purchase Invoice") - # self.assertEqual(gl_entries,expected_result) + gl_entries = frappe.db.sql( + """select account, sum(debit) as debit, sum(credit) as credit , against_voucher + from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s + group by account,against_voucher""", + pi.name, + as_dict=1, + ) + + expected_result = [ + { + "account": "Creditors - _TC", + "debit": 1800.0, + "credit": 90000.0, + "against_voucher": pi.name + }, + { + "account": "Stock Received But Not Billed - _TC", + "debit": 90000.0, + "credit": 0.0, + "against_voucher": None + }, + { + "account": "_Test TDS Payable - _TC", + "debit": 0.0, + "credit": 1800.0, + "against_voucher": None + } + ] + self.assertEqual(gl_entries,expected_result) @@ -2583,7 +2602,7 @@ def test_lower_tax_deduction_TC_ACC_025_and_TC_ACC_026(self): ["Creditors - _TC", 0.0, 50000.0, pi.posting_date], ["Creditors - _TC", 600.0, 0.0, pi.posting_date], ["Stock Received But Not Billed - _TC", 50000.0, 0.0, pi.posting_date], - ["Test TDS Payable - _TC", 0.0, 600.0, pi.posting_date] + ["_Test TDS Payable - _TC", 0.0, 600.0, pi.posting_date] ] check_gl_entries(self, pi.name, expected_gle, pi.posting_date) @@ -2613,6 +2632,8 @@ def test_currency_exchange_with_pi_TC_ACC_027(self): pi.submit() pe = get_payment_entry("Purchase Invoice", pi.name) + pe.payment_type= "Pay" + pe.paid_from = "Cash - _TC" pe.target_exchange_rate = 60 pe.save() pe.submit() @@ -2673,6 +2694,7 @@ def test_advance_payment_TC_ACC_028(self): records_for_pi('_Test Supplier USD') supplier = frappe.get_doc('Supplier', '_Test Supplier USD') + if supplier: pe = create_payment_entry( party_type="Supplier", @@ -2692,13 +2714,14 @@ def test_advance_payment_TC_ACC_028(self): pe.append( "taxes", { - "account_head": "_Test TDS Payable - _TC", + "account_head": "Test TDS Payable - _TC", "charge_type": "On Paid Amount", "rate": 0, "add_deduct_tax": "Deduct", "description": "Cash", }, ) + pe.save() pe.submit() @@ -2758,6 +2781,8 @@ def test_advance_payment_TC_ACC_028(self): _pe = get_payment_entry('Purchase Invoice', pi.name) _pe.target_exchange_rate = 62 + _pe.payment_type= "Pay" + _pe.paid_from = "Cash - _TC" _pe.save() _pe.submit() @@ -2810,15 +2835,29 @@ def test_single_payment_request_for_purchase_invoice_TC_ACC_035(self): dn=pi.name, party_type="Supplier", party=supplier.name, + grand_total=5000, submit_doc=1, return_doc=1, ) - - pe=pr.create_payment_entry() + pe=pr.create_payment_entry(submit=False) + pe.payment_type= "Pay" + pe.paid_from = "Cash - _TC" pe.save() pe.submit() pr.load_from_db() self.assertEqual(pr.status, "Paid") + pe.load_from_db() + expected_gle = [ + ['Cash - _TC', 0.0, 5000.0, pe.posting_date], + ['Creditors - _TC', 5000.0, 0.0, pe.posting_date] + ] + check_gl_entries( + doc=self, + voucher_no=pe.name, + expected_gle=expected_gle, + voucher_type="Payment Entry", + posting_date=pe.posting_date + ) pi.load_from_db() self.assertEqual(pi.status, "Paid") def test_multi_payment_request_for_purchase_invoice_TC_ACC_036(self): @@ -2854,13 +2893,25 @@ def test_multi_payment_request_for_purchase_invoice_TC_ACC_036(self): pr.grand_total = pr.grand_total / 2 pr.save() pr.submit() - pe=pr.create_payment_entry() + pe=pr.create_payment_entry(submit=False) + pe.payment_type= "Pay" + pe.paid_from = "Cash - _TC" pe.save() pe.submit() pr.load_from_db() self.assertEqual(pr.status, "Paid") pe.load_from_db() - + expected_gle = [ + ['Cash - _TC', 0.0, 2500.0, pe.posting_date], + ['Creditors - _TC', 2500.0, 0.0, pe.posting_date] + ] + check_gl_entries( + doc=self, + voucher_no=pe.name, + expected_gle=expected_gle, + voucher_type="Payment Entry", + posting_date=pe.posting_date + ) pi.load_from_db() self.assertEqual(pi.status, "Partly Paid") _pr = make_payment_request( @@ -2871,13 +2922,26 @@ def test_multi_payment_request_for_purchase_invoice_TC_ACC_036(self): return_doc=1, submit_doc=1, ) - _pe=_pr.create_payment_entry() + _pe=_pr.create_payment_entry(submit=False) + _pe.payment_type= "Pay" + _pe.paid_from = "Cash - _TC" _pe.save() _pe.submit() _pr.load_from_db() self.assertEqual(_pr.status, "Paid") - pi.load_from_db() - self.assertEqual(pi.status, "Paid") + _pe.load_from_db() + expected_gle = [ + ['Cash - _TC', 0.0, 2500.0, _pe.posting_date], + ['Creditors - _TC', 2500.0, 0.0, _pe.posting_date] + ] + check_gl_entries( + doc=self, + voucher_no=_pe.name, + expected_gle=expected_gle, + voucher_type="Payment Entry", + posting_date=_pe.posting_date + ) + def test_invoice_status_on_payment_entry_submit_TC_B_035_and_TC_B_037(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry from erpnext.accounts.doctype.unreconcile_payment.unreconcile_payment import payment_reconciliation_record_on_unreconcile,create_unreconcile_doc_for_selection @@ -3216,7 +3280,7 @@ def test_standalone_pi_is_partly_paid_TC_B_090(self): pi_status = frappe.db.get_value("Purchase Invoice", pi.name, "status") self.assertEqual(pi_status, "Partly Paid") - + def set_advance_flag(company, flag, default_account): frappe.db.set_value( "Company", @@ -3253,7 +3317,6 @@ def check_gl_entries( for col in additional_columns: query = query.select(gl[col]) gl_entries = query.run(as_dict=True) - for i, gle in enumerate(gl_entries): doc.assertEqual(expected_gle[i][0], gle.account) doc.assertEqual(expected_gle[i][1], gle.debit) @@ -3489,6 +3552,7 @@ def update_ldc_details(supplier): setattr(supplier,'custom_lower_tds_deduction_applicable','Yes') if not supplier.pan: setattr(supplier,'pan','DAJPC4150P') + supplier.flags.ignore_mandatory = True supplier.save() frappe.db.commit() diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 4806d912a0fe..0982e52a0d64 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -4315,7 +4315,11 @@ def test_jv_records_creation_diff_ex_rate_TC_ACC_029(self): si.save() si.submit() - pe = get_payment_entry("Sales Invoice", si.name) + pe = get_payment_entry("Sales Invoice", si.name) + pe.payment_type == "Receive" + pe.mode_of_payment = "Cash" + pe.paid_from="_Test Receivable USD - _TC" + pe.paid_to = "Cash - _TC" pe.source_exchange_rate = 60 pe.save() pe.submit() diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index 58ac76b83abc..f90d92996a74 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -1091,7 +1091,14 @@ def create_tax_withholding_category( "accounts": [{"company": "_Test Company", "account": account}], } ).insert() - + elif frappe.db.exists("Tax Withholding Category", category_name): + doc = frappe.get_doc("Tax Withholding Category",category_name) + if doc.accounts: + child=frappe.get_doc("Tax Withholding Account",doc.accounts[0].name) + if child.account != account: + child.account=account + child.save() + frappe.db.commit() def create_lower_deduction_certificate(supplier, tax_withholding_category, tax_rate, certificate_no, limit): fiscal_year = get_fiscal_year(today(), company="_Test Company")