blob: a098e33ef3a0b001f174d4e3ac8f063610d47273 [file] [log] [blame]
Rushabh Mehta95e4e142012-09-13 19:40:56 +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
Nabin Hait9a90c892012-09-18 13:37:27 +053017from __future__ import unicode_literals
Rushabh Mehta823c0212012-09-19 12:01:01 +053018
19# mappings for table dumps
20# "remember to add indexes!"
21
Rushabh Mehta95e4e142012-09-13 19:40:56 +053022data_map = {
Rushabh Mehtaf200c522012-09-21 15:19:40 +053023 "Company": {
24 "columns": ["name"],
25 "conditions": ["docstatus < 2"]
26 },
27 "Fiscal Year": {
28 "columns": ["name", "year_start_date",
29 "adddate(adddate(year_start_date, interval 1 year), interval -1 day) as year_end_date"]
30 },
31
32 # Accounts
Rushabh Mehta95e4e142012-09-13 19:40:56 +053033 "Account": {
Anand Doshibc243de2012-09-24 18:03:35 +053034 "columns": ["name", "parent_account", "lft", "rgt", "debit_or_credit",
35 "is_pl_account", "company"],
Rushabh Mehta95e4e142012-09-13 19:40:56 +053036 "order_by": "lft"
37 },
Rushabh Mehta41565232012-09-17 19:10:36 +053038 "Cost Center": {
Rushabh Mehta09d84b62012-09-21 19:46:24 +053039 "columns": ["name", "lft", "rgt"],
Rushabh Mehta41565232012-09-17 19:10:36 +053040 "order_by": "lft"
41 },
Rushabh Mehta95e4e142012-09-13 19:40:56 +053042 "GL Entry": {
43 "columns": ["account", "posting_date", "cost_center", "debit", "credit", "is_opening",
Rushabh Mehtacfb54662012-09-14 18:12:17 +053044 "company", "voucher_type", "voucher_no", "remarks"],
Rushabh Mehta95e4e142012-09-13 19:40:56 +053045 "conditions": ["ifnull(is_cancelled, 'No')='No'"],
Rushabh Mehta823c0212012-09-19 12:01:01 +053046 "order_by": "posting_date, account",
47 "links": {
48 "account": ["Account", "name"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +053049 "company": ["Company", "name"],
50 "cost_center": ["Cost Center", "name"]
Rushabh Mehta823c0212012-09-19 12:01:01 +053051 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +053052 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053053
54 # Stock
55 "Item": {
56 "columns": ["name", "if(item_name=name, '', item_name) as item_name",
Rushabh Mehta09d84b62012-09-21 19:46:24 +053057 "item_group as parent_item_group", "stock_uom", "brand", "valuation_method"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053058 "order_by": "name",
59 "links": {
60 "parent_item_group": ["Item Group", "name"],
61 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +053062 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053063 "Item Group": {
64 "columns": ["name", "parent_item_group"],
65 "order_by": "lft"
66 },
67 "Warehouse": {
68 "columns": ["name"],
69 "order_by": "name"
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053070 },
71 "Stock Ledger Entry": {
72 "columns": ["posting_date", "posting_time", "item_code", "warehouse", "actual_qty as qty",
Rushabh Mehta6ca80542012-09-20 19:03:14 +053073 "voucher_type", "voucher_no", "ifnull(incoming_rate,0) as incoming_rate"],
Rushabh Mehta823c0212012-09-19 12:01:01 +053074 "conditions": ["ifnull(is_cancelled, 'No')='No'"],
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053075 "order_by": "posting_date, posting_time, name",
76 "links": {
77 "item_code": ["Item", "name"],
78 "warehouse": ["Warehouse", "name"]
Rushabh Mehta823c0212012-09-19 12:01:01 +053079 },
80 "force_index": "posting_sort_index"
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053081 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053082
83 # Sales
84 "Customer": {
85 "columns": ["name", "if(customer_name=name, '', customer_name) as customer_name",
86 "customer_group as parent_customer_group", "territory as parent_territory"],
87 "order_by": "name",
88 "links": {
89 "parent_customer_group": ["Customer Group", "name"],
90 "parent_territory": ["Territory", "name"],
91 }
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053092 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053093 "Customer Group": {
94 "columns": ["name", "parent_customer_group"],
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053095 "order_by": "lft"
96 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053097 "Territory": {
98 "columns": ["name", "parent_territory"],
99 "order_by": "lft"
100 },
101 "Sales Invoice": {
102 "columns": ["name", "customer", "posting_date", "company"],
103 "conditions": ["docstatus=1"],
104 "order_by": "posting_date",
105 "links": {
106 "customer": ["Customer", "name"],
107 "company":["Company", "name"]
108 }
109 },
110 "Sales Invoice Item": {
111 "columns": ["parent", "item_code", "qty", "amount"],
112 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
113 "order_by": "parent",
114 "links": {
115 "parent": ["Sales Invoice", "name"],
116 "item_code": ["Item", "name"]
117 }
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530118 },
119 "Supplier": {
120 "columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
121 "supplier_type as parent_supplier_type"],
122 "order_by": "name",
123 "links": {
124 "parent_supplier_type": ["Supplier Type", "name"],
125 }
126 },
127 "Supplier Type": {
128 "columns": ["name"],
129 "order_by": "name"
130 },
131 "Purchase Invoice": {
132 "columns": ["name", "supplier", "posting_date", "company"],
133 "conditions": ["docstatus=1"],
134 "order_by": "posting_date",
135 "links": {
136 "supplier": ["Supplier", "name"],
137 "company":["Company", "name"]
138 }
139 },
140 "Purchase Invoice Item": {
141 "columns": ["parent", "item_code", "qty", "amount"],
142 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
143 "order_by": "parent",
144 "links": {
145 "parent": ["Purchase Invoice", "name"],
146 "item_code": ["Item", "name"]
147 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +0530148 }
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530149
Rushabh Mehta95e4e142012-09-13 19:40:56 +0530150}