Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +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 | |
Nabin Hait | 9a90c89 | 2012-09-18 13:37:27 +0530 | [diff] [blame] | 17 | from __future__ import unicode_literals |
Rushabh Mehta | 823c021 | 2012-09-19 12:01:01 +0530 | [diff] [blame] | 18 | |
| 19 | # mappings for table dumps |
| 20 | # "remember to add indexes!" |
| 21 | |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 22 | data_map = { |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 23 | "Company": { |
| 24 | "columns": ["name"], |
| 25 | "conditions": ["docstatus < 2"] |
| 26 | }, |
| 27 | "Fiscal Year": { |
| 28 | "columns": ["name", "year_start_date", |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 29 | "adddate(adddate(year_start_date, interval 1 year), interval -1 day) as year_end_date"], |
| 30 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 31 | }, |
| 32 | |
| 33 | # Accounts |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 34 | "Account": { |
Anand Doshi | bc243de | 2012-09-24 18:03:35 +0530 | [diff] [blame] | 35 | "columns": ["name", "parent_account", "lft", "rgt", "debit_or_credit", |
Rushabh Mehta | c68fc3f | 2012-11-13 13:28:26 +0530 | [diff] [blame] | 36 | "is_pl_account", "company", "group_or_ledger"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 37 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | c68fc3f | 2012-11-13 13:28:26 +0530 | [diff] [blame] | 38 | "order_by": "lft", |
| 39 | "links": { |
| 40 | "company": ["Company", "name"], |
| 41 | } |
| 42 | |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 43 | }, |
Rushabh Mehta | 4156523 | 2012-09-17 19:10:36 +0530 | [diff] [blame] | 44 | "Cost Center": { |
Rushabh Mehta | 09d84b6 | 2012-09-21 19:46:24 +0530 | [diff] [blame] | 45 | "columns": ["name", "lft", "rgt"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 46 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | 4156523 | 2012-09-17 19:10:36 +0530 | [diff] [blame] | 47 | "order_by": "lft" |
| 48 | }, |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 49 | "GL Entry": { |
| 50 | "columns": ["account", "posting_date", "cost_center", "debit", "credit", "is_opening", |
Rushabh Mehta | cfb5466 | 2012-09-14 18:12:17 +0530 | [diff] [blame] | 51 | "company", "voucher_type", "voucher_no", "remarks"], |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 52 | "conditions": ["ifnull(is_cancelled, 'No')='No'"], |
Rushabh Mehta | 823c021 | 2012-09-19 12:01:01 +0530 | [diff] [blame] | 53 | "order_by": "posting_date, account", |
| 54 | "links": { |
| 55 | "account": ["Account", "name"], |
Rushabh Mehta | 09d84b6 | 2012-09-21 19:46:24 +0530 | [diff] [blame] | 56 | "company": ["Company", "name"], |
| 57 | "cost_center": ["Cost Center", "name"] |
Rushabh Mehta | 823c021 | 2012-09-19 12:01:01 +0530 | [diff] [blame] | 58 | } |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 59 | }, |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 60 | |
| 61 | # Stock |
| 62 | "Item": { |
| 63 | "columns": ["name", "if(item_name=name, '', item_name) as item_name", |
Rushabh Mehta | 09d84b6 | 2012-09-21 19:46:24 +0530 | [diff] [blame] | 64 | "item_group as parent_item_group", "stock_uom", "brand", "valuation_method"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 65 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 66 | "order_by": "name", |
| 67 | "links": { |
| 68 | "parent_item_group": ["Item Group", "name"], |
| 69 | } |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 70 | }, |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 71 | "Item Group": { |
| 72 | "columns": ["name", "parent_item_group"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 73 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 74 | "order_by": "lft" |
| 75 | }, |
| 76 | "Warehouse": { |
| 77 | "columns": ["name"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 78 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 79 | "order_by": "name" |
Rushabh Mehta | 2ad0d42 | 2012-09-18 18:52:05 +0530 | [diff] [blame] | 80 | }, |
| 81 | "Stock Ledger Entry": { |
| 82 | "columns": ["posting_date", "posting_time", "item_code", "warehouse", "actual_qty as qty", |
Rushabh Mehta | 6ca8054 | 2012-09-20 19:03:14 +0530 | [diff] [blame] | 83 | "voucher_type", "voucher_no", "ifnull(incoming_rate,0) as incoming_rate"], |
Rushabh Mehta | 823c021 | 2012-09-19 12:01:01 +0530 | [diff] [blame] | 84 | "conditions": ["ifnull(is_cancelled, 'No')='No'"], |
Rushabh Mehta | 2ad0d42 | 2012-09-18 18:52:05 +0530 | [diff] [blame] | 85 | "order_by": "posting_date, posting_time, name", |
| 86 | "links": { |
| 87 | "item_code": ["Item", "name"], |
| 88 | "warehouse": ["Warehouse", "name"] |
Rushabh Mehta | 823c021 | 2012-09-19 12:01:01 +0530 | [diff] [blame] | 89 | }, |
| 90 | "force_index": "posting_sort_index" |
Rushabh Mehta | 2ad0d42 | 2012-09-18 18:52:05 +0530 | [diff] [blame] | 91 | }, |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 92 | |
| 93 | # Sales |
| 94 | "Customer": { |
| 95 | "columns": ["name", "if(customer_name=name, '', customer_name) as customer_name", |
| 96 | "customer_group as parent_customer_group", "territory as parent_territory"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 97 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 98 | "order_by": "name", |
| 99 | "links": { |
| 100 | "parent_customer_group": ["Customer Group", "name"], |
| 101 | "parent_territory": ["Territory", "name"], |
| 102 | } |
Rushabh Mehta | 2ad0d42 | 2012-09-18 18:52:05 +0530 | [diff] [blame] | 103 | }, |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 104 | "Customer Group": { |
| 105 | "columns": ["name", "parent_customer_group"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 106 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | 2ad0d42 | 2012-09-18 18:52:05 +0530 | [diff] [blame] | 107 | "order_by": "lft" |
| 108 | }, |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 109 | "Territory": { |
| 110 | "columns": ["name", "parent_territory"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 111 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | f200c52 | 2012-09-21 15:19:40 +0530 | [diff] [blame] | 112 | "order_by": "lft" |
| 113 | }, |
| 114 | "Sales Invoice": { |
| 115 | "columns": ["name", "customer", "posting_date", "company"], |
| 116 | "conditions": ["docstatus=1"], |
| 117 | "order_by": "posting_date", |
| 118 | "links": { |
| 119 | "customer": ["Customer", "name"], |
| 120 | "company":["Company", "name"] |
| 121 | } |
| 122 | }, |
| 123 | "Sales Invoice Item": { |
| 124 | "columns": ["parent", "item_code", "qty", "amount"], |
| 125 | "conditions": ["docstatus=1", "ifnull(parent, '')!=''"], |
| 126 | "order_by": "parent", |
| 127 | "links": { |
| 128 | "parent": ["Sales Invoice", "name"], |
| 129 | "item_code": ["Item", "name"] |
| 130 | } |
Rushabh Mehta | 09d84b6 | 2012-09-21 19:46:24 +0530 | [diff] [blame] | 131 | }, |
| 132 | "Supplier": { |
| 133 | "columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name", |
| 134 | "supplier_type as parent_supplier_type"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 135 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | 09d84b6 | 2012-09-21 19:46:24 +0530 | [diff] [blame] | 136 | "order_by": "name", |
| 137 | "links": { |
| 138 | "parent_supplier_type": ["Supplier Type", "name"], |
| 139 | } |
| 140 | }, |
| 141 | "Supplier Type": { |
| 142 | "columns": ["name"], |
Anand Doshi | 73519e1 | 2012-10-11 14:04:27 +0530 | [diff] [blame] | 143 | "conditions": ["docstatus < 2"], |
Rushabh Mehta | 09d84b6 | 2012-09-21 19:46:24 +0530 | [diff] [blame] | 144 | "order_by": "name" |
| 145 | }, |
| 146 | "Purchase Invoice": { |
| 147 | "columns": ["name", "supplier", "posting_date", "company"], |
| 148 | "conditions": ["docstatus=1"], |
| 149 | "order_by": "posting_date", |
| 150 | "links": { |
| 151 | "supplier": ["Supplier", "name"], |
| 152 | "company":["Company", "name"] |
| 153 | } |
| 154 | }, |
| 155 | "Purchase Invoice Item": { |
| 156 | "columns": ["parent", "item_code", "qty", "amount"], |
| 157 | "conditions": ["docstatus=1", "ifnull(parent, '')!=''"], |
| 158 | "order_by": "parent", |
| 159 | "links": { |
| 160 | "parent": ["Purchase Invoice", "name"], |
| 161 | "item_code": ["Item", "name"] |
| 162 | } |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 163 | } |
Rushabh Mehta | 09d84b6 | 2012-09-21 19:46:24 +0530 | [diff] [blame] | 164 | |
Rushabh Mehta | 95e4e14 | 2012-09-13 19:40:56 +0530 | [diff] [blame] | 165 | } |