Rushabh Mehta | 5e7ec20 | 2013-01-11 11:15:27 +0530 | [diff] [blame] | 1 | // 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 Mehta | 5e7ec20 | 2013-01-11 11:15:27 +0530 | [diff] [blame] | 18 | wn.provide("erpnext.queries"); |
Anand Doshi | 61cad50 | 2013-07-18 13:26:27 +0530 | [diff] [blame] | 19 | $.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 Mehta | 5e7ec20 | 2013-01-11 11:15:27 +0530 | [diff] [blame] | 57 | |
Anand Doshi | 61cad50 | 2013-07-18 13:26:27 +0530 | [diff] [blame] | 58 | return { filters: { customer: doc.customer } }; |
| 59 | }, |
Rushabh Mehta | 5e7ec20 | 2013-01-11 11:15:27 +0530 | [diff] [blame] | 60 | |
Anand Doshi | 61cad50 | 2013-07-18 13:26:27 +0530 | [diff] [blame] | 61 | not_a_group_filter: function() { |
| 62 | return { filters: { is_group: "No" } }; |
| 63 | }, |
Rushabh Mehta | 5e7ec20 | 2013-01-11 11:15:27 +0530 | [diff] [blame] | 64 | |
Anand Doshi | 61cad50 | 2013-07-18 13:26:27 +0530 | [diff] [blame] | 65 | }); |