blob: 8c3dd012035e70a52f9faa5409cb8dd4f97437ef [file] [log] [blame]
Rushabh Mehta5e7ec202013-01-11 11:15:27 +05301// ERPNext - web based ERP (http://erpnext.com)
2// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17// searches for enabled profiles
Rushabh Mehta5e7ec202013-01-11 11:15:27 +053018wn.provide("erpnext.queries");
Anand Doshi61cad502013-07-18 13:26:27 +053019$.extend(erpnext.queries, {
20 profile: function() {
21 return { query: "controllers.queries.profile_query" };
22 },
23
24 lead: function() {
25 return { query: "controllers.queries.lead_query" };
26 },
27
28 customer: function() {
29 return { query: "controllers.queries.customer_query" };
30 },
31
32 supplier: function() {
33 return { query: "controllers.queries.supplier_query" };
34 },
35
36 account: function() {
37 return { query: "controllers.queries.account_query" };
38 },
39
40 item: function() {
41 return { query: "controllers.queries.item_query" };
42 },
43
44 bom: function() {
45 return { query: "controllers.queries.bom" };
46 },
47
48 task: function() {
49 return { query: "projects.utils.query_task" };
50 },
51
52 customer_filter: function(doc) {
53 if(!doc.customer) {
54 wn.throw(wn._("Please specify a") + " " +
55 wn._(wn.meta.get_label(doc.doctype, "customer", doc.name)));
56 }
Rushabh Mehta5e7ec202013-01-11 11:15:27 +053057
Anand Doshi61cad502013-07-18 13:26:27 +053058 return { filters: { customer: doc.customer } };
59 },
Rushabh Mehta5e7ec202013-01-11 11:15:27 +053060
Anand Doshi61cad502013-07-18 13:26:27 +053061 not_a_group_filter: function() {
62 return { filters: { is_group: "No" } };
63 },
Rushabh Mehta5e7ec202013-01-11 11:15:27 +053064
Anand Doshi61cad502013-07-18 13:26:27 +053065});