forked from frappe/erpnext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueries.js
69 lines (54 loc) · 1.59 KB
/
queries.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
// searches for enabled profiles
wn.provide("erpnext.queries");
$.extend(erpnext.queries, {
profile: function() {
return { query: "core.doctype.profile.profile.profile_query" };
},
lead: function() {
return { query: "controllers.queries.lead_query" };
},
customer: function() {
return { query: "controllers.queries.customer_query" };
},
supplier: function() {
return { query: "controllers.queries.supplier_query" };
},
account: function() {
return { query: "controllers.queries.account_query" };
},
item: function() {
return { query: "controllers.queries.item_query" };
},
bom: function() {
return { query: "controllers.queries.bom" };
},
task: function() {
return { query: "projects.utils.query_task" };
},
customer_filter: function(doc) {
if(!doc.customer) {
wn.throw(wn._("Please specify a") + " " +
wn._(wn.meta.get_label(doc.doctype, "customer", doc.name)));
}
return { filters: { customer: doc.customer } };
},
supplier_filter: function(doc) {
if(!doc.supplier) {
wn.throw(wn._("Please specify a") + " " +
wn._(wn.meta.get_label(doc.doctype, "supplier", doc.name)));
}
return { filters: { supplier: doc.supplier } };
},
lead_filter: function(doc) {
if(!doc.lead) {
wn.throw(wn._("Please specify a") + " " +
wn._(wn.meta.get_label(doc.doctype, "lead", doc.name)));
}
return { filters: { lead: doc.lead } };
},
not_a_group_filter: function() {
return { filters: { is_group: "No" } };
},
});