Party is now dynamic link in JV and GL Entry

This commit is contained in:
Nabin Hait 2014-09-11 19:26:55 +05:30
parent 62c762aac5
commit 965a5a34b5
3 changed files with 13 additions and 19 deletions

View File

@ -49,16 +49,16 @@
},
{
"fieldname": "party_type",
"fieldtype": "Select",
"fieldtype": "Link",
"label": "Party Type",
"options": "\nCustomer\nSupplier",
"options": "DocType",
"permlevel": 0
},
{
"fieldname": "party",
"fieldtype": "Link",
"fieldtype": "Dynamic Link",
"label": "Party",
"options": "[Select]",
"options": "party_type",
"permlevel": 0
},
{
@ -203,7 +203,7 @@
"icon": "icon-list",
"idx": 1,
"in_create": 1,
"modified": "2014-08-26 17:56:49.147121",
"modified": "2014-09-11 18:35:22.822064",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GL Entry",

View File

@ -41,18 +41,12 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
});
});
me.frm.set_query("party", "entries", function(doc, cdt, cdn) {
var jvd = frappe.get_doc(cdt, cdn);
if(!jvd.party_type) {
frappe.throw(__("Please enter Party Type first"));
} else {
return {
doctype: jvd.party_type
}
me.frm.set_query("party_type", "entries", function(doc, cdt, cdn) {
return {
filters: {"name": ["in", ["Customer", "Supplier"]]}
}
});
$.each([["against_voucher", "Purchase Invoice", "supplier"],
["against_invoice", "Sales Invoice", "customer"]], function(i, opts) {
me.frm.set_query(opts[0], "entries", function(doc, cdt, cdn) {

View File

@ -43,16 +43,16 @@
},
{
"fieldname": "party_type",
"fieldtype": "Select",
"fieldtype": "Link",
"label": "Party Type",
"options": "\nCustomer\nSupplier",
"options": "DocType",
"permlevel": 0
},
{
"fieldname": "party",
"fieldtype": "Link",
"fieldtype": "Dynamic Link",
"label": "Party",
"options": "[Select]",
"options": "party_type",
"permlevel": 0
},
{
@ -188,7 +188,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-08-26 17:56:34.294770",
"modified": "2014-09-11 18:33:53.705093",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Voucher Detail",