[minor] ui/ux fixes in Payment Tool
This commit is contained in:
parent
8e7ca41817
commit
61a591944b
0
erpnext/accounts/doctype/payment_tool/__init__.py
Normal file
0
erpnext/accounts/doctype/payment_tool/__init__.py
Normal file
@ -4,12 +4,34 @@
|
|||||||
frappe.provide("erpnext.payment_tool");
|
frappe.provide("erpnext.payment_tool");
|
||||||
|
|
||||||
// Help content
|
// Help content
|
||||||
frappe.ui.form.on("Payment Tool", "onload", function(frm) {
|
frappe.ui.form.on("Payment Tool", "onload", function(frm) {
|
||||||
var help_content = '<i class="icon-hand-right"></i> Note:<br>'+
|
frm.set_value("make_jv_help", '<i class="icon-hand-right"></i> '
|
||||||
'<ul>If payment is not made against any reference, make Journal Voucher manually.</ul>';
|
+ __("Note: If payment is not made against any reference, make Journal Voucher manually."));
|
||||||
frm.set_value("make_jv_help", help_content);
|
|
||||||
|
|
||||||
frm.set_value("party_type", "Customer");
|
frm.set_query("payment_account", function() {
|
||||||
|
return {
|
||||||
|
filters: [
|
||||||
|
['Account', 'account_type', 'in', 'Bank, Cash'],
|
||||||
|
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||||
|
['Account', 'company', '=', frm.doc.company]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query("against_voucher_type", "payment_tool_details", function() {
|
||||||
|
return {
|
||||||
|
filters: {"name": ["in", ["Sales Invoice", "Purchase Invoice", "Journal Voucher", "Sales Order", "Purchase Order"]]}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.ui.form.on("Payment Tool", "refresh", function(frm) {
|
||||||
|
frappe.ui.form.trigger("Payment Tool", "party_type");
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.ui.form.on("Payment Tool", "party_type", function(frm) {
|
||||||
|
frm.toggle_reqd("customer", frm.doc.party_type == "Customer");
|
||||||
|
frm.toggle_reqd("supplier", frm.doc.party_type == "Supplier");
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on("Payment Tool", "company", function(frm) {
|
frappe.ui.form.on("Payment Tool", "company", function(frm) {
|
||||||
@ -79,9 +101,11 @@ frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
callback: function(r, rt) {
|
callback: function(r, rt) {
|
||||||
frm.fields_dict.get_outstanding_vouchers.$input.removeClass("btn-primary");
|
|
||||||
frm.fields_dict.make_journal_voucher.$input.addClass("btn-primary");
|
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
|
frm.fields_dict.get_outstanding_vouchers.$input.removeClass("btn-primary");
|
||||||
|
frm.fields_dict.make_journal_voucher.$input.addClass("btn-primary");
|
||||||
|
|
||||||
|
frappe.model.clear_table(frm.doc, "payment_tool_details");
|
||||||
$.each(r.message, function(i, d) {
|
$.each(r.message, function(i, d) {
|
||||||
var invoice_detail = frappe.model.add_child(frm.doc, "Payment Tool Detail", "payment_tool_details");
|
var invoice_detail = frappe.model.add_child(frm.doc, "Payment Tool Detail", "payment_tool_details");
|
||||||
invoice_detail.against_voucher_type = d.voucher_type;
|
invoice_detail.against_voucher_type = d.voucher_type;
|
||||||
@ -89,10 +113,9 @@ frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) {
|
|||||||
invoice_detail.total_amount = d.invoice_amount;
|
invoice_detail.total_amount = d.invoice_amount;
|
||||||
invoice_detail.outstanding_amount = d.outstanding_amount;
|
invoice_detail.outstanding_amount = d.outstanding_amount;
|
||||||
});
|
});
|
||||||
refresh_field("payment_tool_details");
|
|
||||||
frm.refresh_dependency();
|
|
||||||
}
|
}
|
||||||
|
refresh_field("payment_tool_details");
|
||||||
|
erpnext.payment_tool.set_total_payment_amount(frm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -180,27 +203,6 @@ frappe.ui.form.on("Payment Tool", "make_journal_voucher", function(frm) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
cur_frm.fields_dict['payment_tool_details'].grid.get_field('against_voucher_no').get_query = function(doc, cdt, cdn) {
|
|
||||||
var c = locals[cdt][cdn];
|
|
||||||
|
|
||||||
erpnext.payment_tool.check_mandatory_to_fetch(doc);
|
|
||||||
|
|
||||||
args = { "docstatus": 1 };
|
|
||||||
|
|
||||||
if (c.against_voucher_type) {
|
|
||||||
if (in_list(["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"], c.against_voucher_type)) {
|
|
||||||
var party_type = doc.party_type.toLowerCase();
|
|
||||||
args[party_type] = doc[party_type];
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
doctype: c.against_voucher_type,
|
|
||||||
filters: args
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
frappe.throw(__("Row {0}: Please specify the Against Voucher Type", [c.idx]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
erpnext.payment_tool.check_mandatory_to_fetch = function(doc) {
|
erpnext.payment_tool.check_mandatory_to_fetch = function(doc) {
|
||||||
var check_fields = [
|
var check_fields = [
|
||||||
['Company', doc.company],
|
['Company', doc.company],
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"allow_attach": 0,
|
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
@ -25,6 +24,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
|
"default": "Customer",
|
||||||
"fieldname": "party_type",
|
"fieldname": "party_type",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -111,6 +111,24 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0
|
"set_only_once": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"fieldname": "get_outstanding_vouchers",
|
||||||
|
"fieldtype": "Button",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Get Outstanding Vouchers",
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"fieldname": "col_break1",
|
"fieldname": "col_break1",
|
||||||
@ -203,34 +221,6 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0
|
"set_only_once": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "sec_break2",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "column_break_14",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"permlevel": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"fieldname": "get_outstanding_vouchers",
|
|
||||||
"fieldtype": "Button",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "Get Outstanding Vouchers",
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))",
|
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))",
|
||||||
@ -269,6 +259,13 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0
|
"set_only_once": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))",
|
||||||
|
"fieldname": "section_break_19",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "total_payment_amount",
|
"fieldname": "total_payment_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
@ -294,6 +291,19 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0
|
"set_only_once": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "data_22",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && (doc.customer || doc.supplier))",
|
||||||
|
"fieldname": "section_break_21",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"fieldname": "make_jv_help",
|
"fieldname": "make_jv_help",
|
||||||
@ -320,7 +330,7 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"modified": "2014-09-05 11:15:55.484916",
|
"modified": "2014-09-12 04:43:05.963218",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Tool",
|
"name": "Payment Tool",
|
||||||
|
@ -59,6 +59,9 @@ def get_party_account(party_type, party_name):
|
|||||||
def get_outstanding_vouchers(args):
|
def get_outstanding_vouchers(args):
|
||||||
from erpnext.accounts.utils import get_outstanding_invoices
|
from erpnext.accounts.utils import get_outstanding_invoices
|
||||||
|
|
||||||
|
if not frappe.has_permission("Payment Tool"):
|
||||||
|
frappe.throw(_("No permission to use Payment Tool"), frappe.PermissionError)
|
||||||
|
|
||||||
args = json.loads(args)
|
args = json.loads(args)
|
||||||
|
|
||||||
if args.get("party_type") == "Customer" and args.get("received_or_paid") == "Received":
|
if args.get("party_type") == "Customer" and args.get("received_or_paid") == "Received":
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"allow_attach": 0,
|
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
@ -12,14 +11,14 @@
|
|||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"fieldname": "against_voucher_type",
|
"fieldname": "against_voucher_type",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Against Voucher Type",
|
"label": "Against Voucher Type",
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"options": "\nSales Invoice\nPurchase Invoice\nJournal Voucher\nSales Order\nPurchase Order",
|
"options": "DocType",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_width": "",
|
"print_width": "",
|
||||||
@ -33,14 +32,14 @@
|
|||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"fieldname": "against_voucher_no",
|
"fieldname": "against_voucher_no",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Dynamic Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Against Voucher No",
|
"label": "Against Voucher No",
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"options": "[Select]",
|
"options": "against_voucher_type",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
@ -49,6 +48,12 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0
|
"set_only_once": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_3",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"fieldname": "total_amount",
|
"fieldname": "total_amount",
|
||||||
@ -111,7 +116,7 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2014-08-20 12:32:29.842215",
|
"modified": "2014-09-11 08:55:34.384017",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Tool Detail",
|
"name": "Payment Tool Detail",
|
||||||
|
@ -657,7 +657,7 @@
|
|||||||
"icon": "icon-file-text",
|
"icon": "icon-file-text",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2014-09-09 05:35:32.583024",
|
"modified": "2014-09-10 05:35:32.583024",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Purchase Order",
|
"name": "Purchase Order",
|
||||||
|
@ -559,14 +559,6 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"width": "200px"
|
"width": "200px"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "advance_paid",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"label": "Advance Paid",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 1,
|
|
||||||
"read_only": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "view_details",
|
"fieldname": "view_details",
|
||||||
"fieldtype": "Fold",
|
"fieldtype": "Fold",
|
||||||
@ -1036,7 +1028,7 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"modified": "2014-09-09 05:35:34.761247",
|
"modified": "2014-09-10 05:35:34.761247",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Sales Order",
|
"name": "Sales Order",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user