blob: b981d552fa3b2dae8fbb932f1ddb8e92403be399 [file] [log] [blame]
Rushabh Mehtaad45e312013-11-20 12:59:58 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05302# License: GNU General Public License v3. See license.txt
Rushabh Mehta95e4e142012-09-13 19:40:56 +05303
Nabin Hait9a90c892012-09-18 13:37:27 +05304from __future__ import unicode_literals
Rushabh Mehta823c0212012-09-19 12:01:01 +05305
6# mappings for table dumps
7# "remember to add indexes!"
8
Rushabh Mehta95e4e142012-09-13 19:40:56 +05309data_map = {
Rushabh Mehtaf200c522012-09-21 15:19:40 +053010 "Company": {
11 "columns": ["name"],
12 "conditions": ["docstatus < 2"]
13 },
14 "Fiscal Year": {
Akhilesh Darjeeec0da0b2013-11-25 19:51:18 +053015 "columns": ["name", "year_start_date", "year_end_date"],
Anand Doshi73519e12012-10-11 14:04:27 +053016 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053017 },
18
19 # Accounts
Rushabh Mehta95e4e142012-09-13 19:40:56 +053020 "Account": {
Anand Doshibc243de2012-09-24 18:03:35 +053021 "columns": ["name", "parent_account", "lft", "rgt", "debit_or_credit",
Rushabh Mehtac68fc3f2012-11-13 13:28:26 +053022 "is_pl_account", "company", "group_or_ledger"],
Anand Doshi73519e12012-10-11 14:04:27 +053023 "conditions": ["docstatus < 2"],
Rushabh Mehtac68fc3f2012-11-13 13:28:26 +053024 "order_by": "lft",
25 "links": {
26 "company": ["Company", "name"],
27 }
28
Rushabh Mehta95e4e142012-09-13 19:40:56 +053029 },
Rushabh Mehta41565232012-09-17 19:10:36 +053030 "Cost Center": {
Rushabh Mehta09d84b62012-09-21 19:46:24 +053031 "columns": ["name", "lft", "rgt"],
Anand Doshi73519e12012-10-11 14:04:27 +053032 "conditions": ["docstatus < 2"],
Rushabh Mehta41565232012-09-17 19:10:36 +053033 "order_by": "lft"
34 },
Rushabh Mehta95e4e142012-09-13 19:40:56 +053035 "GL Entry": {
Nabin Haitf78d16c2013-06-21 15:13:49 +053036 "columns": ["name", "account", "posting_date", "cost_center", "debit", "credit",
Nabin Hait8b96ba12013-06-24 13:54:16 +053037 "is_opening", "company", "voucher_type", "voucher_no", "remarks"],
Rushabh Mehta823c0212012-09-19 12:01:01 +053038 "order_by": "posting_date, account",
39 "links": {
40 "account": ["Account", "name"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +053041 "company": ["Company", "name"],
42 "cost_center": ["Cost Center", "name"]
Rushabh Mehta823c0212012-09-19 12:01:01 +053043 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +053044 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053045
46 # Stock
47 "Item": {
Nabin Hait6072a682012-12-31 17:16:23 +053048 "columns": ["name", "if(item_name=name, '', item_name) as item_name", "description",
Nabin Hait44ffd432013-01-16 11:16:21 +053049 "item_group as parent_item_group", "stock_uom", "brand", "valuation_method",
50 "re_order_level", "re_order_qty"],
Nabin Hait1c08aee2012-12-31 13:30:18 +053051 # "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053052 "order_by": "name",
53 "links": {
54 "parent_item_group": ["Item Group", "name"],
Nabin Haitce159ab2012-12-25 18:04:10 +053055 "brand": ["Brand", "name"]
Rushabh Mehtaf200c522012-09-21 15:19:40 +053056 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +053057 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053058 "Item Group": {
59 "columns": ["name", "parent_item_group"],
Nabin Hait3e8eca32013-06-24 17:18:24 +053060 # "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053061 "order_by": "lft"
62 },
Nabin Haitce159ab2012-12-25 18:04:10 +053063 "Brand": {
64 "columns": ["name"],
65 "conditions": ["docstatus < 2"],
66 "order_by": "name"
67 },
Rushabh Mehta06d186b2013-03-25 17:03:52 +053068 "Project": {
69 "columns": ["name"],
70 "conditions": ["docstatus < 2"],
71 "order_by": "name"
72 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053073 "Warehouse": {
74 "columns": ["name"],
Anand Doshi73519e12012-10-11 14:04:27 +053075 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053076 "order_by": "name"
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053077 },
78 "Stock Ledger Entry": {
Anand Doshid5aeb212013-03-08 12:46:48 +053079 "columns": ["name", "posting_date", "posting_time", "item_code", "warehouse",
Rushabh Mehta06d186b2013-03-25 17:03:52 +053080 "actual_qty as qty", "voucher_type", "voucher_no", "project",
Anand Doshid5aeb212013-03-08 12:46:48 +053081 "ifnull(incoming_rate,0) as incoming_rate", "stock_uom", "serial_no"],
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053082 "order_by": "posting_date, posting_time, name",
83 "links": {
84 "item_code": ["Item", "name"],
Rushabh Mehta06d186b2013-03-25 17:03:52 +053085 "warehouse": ["Warehouse", "name"],
86 "project": ["Project", "name"]
Rushabh Mehta823c0212012-09-19 12:01:01 +053087 },
Nabin Hait30f53462012-12-28 15:39:55 +053088 "force_index": "posting_sort_index"
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053089 },
Nabin Haite505fbe2013-11-15 13:38:23 +053090 "Serial No": {
91 "columns": ["name", "purchase_rate as incoming_rate"],
92 "conditions": ["docstatus < 2"],
93 "order_by": "name"
94 },
Nabin Haitce159ab2012-12-25 18:04:10 +053095 "Stock Entry": {
96 "columns": ["name", "purpose"],
97 "conditions": ["docstatus=1"],
98 "order_by": "posting_date, posting_time, name",
99 },
Nabin Hait30f53462012-12-28 15:39:55 +0530100 "Production Order": {
Rushabh Mehta677b4b42013-02-07 22:19:47 +0530101 "columns": ["name", "production_item as item_code",
Nabin Hait30f53462012-12-28 15:39:55 +0530102 "(ifnull(qty, 0) - ifnull(produced_qty, 0)) as qty",
103 "fg_warehouse as warehouse"],
104 "conditions": ["docstatus=1", "status != 'Stopped'", "ifnull(fg_warehouse, '')!=''",
105 "ifnull(qty, 0) > ifnull(produced_qty, 0)"],
106 "links": {
107 "item_code": ["Item", "name"],
108 "warehouse": ["Warehouse", "name"]
109 },
110 },
Anand Doshi236cc172013-02-18 13:49:15 +0530111 "Material Request Item": {
Rushabh Mehta66aa2652013-02-08 15:06:05 +0530112 "columns": ["item.name as name", "item_code", "warehouse",
Nabin Hait30f53462012-12-28 15:39:55 +0530113 "(ifnull(qty, 0) - ifnull(ordered_qty, 0)) as qty"],
Anand Doshi236cc172013-02-18 13:49:15 +0530114 "from": "`tabMaterial Request Item` item, `tabMaterial Request` main",
Anand Doshicf055802013-02-20 18:44:10 +0530115 "conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
Anand Doshi1678f6d2013-02-21 16:55:14 +0530116 "ifnull(warehouse, '')!=''", "ifnull(qty, 0) > ifnull(ordered_qty, 0)"],
Nabin Hait30f53462012-12-28 15:39:55 +0530117 "links": {
118 "item_code": ["Item", "name"],
119 "warehouse": ["Warehouse", "name"]
120 },
121 },
122 "Purchase Order Item": {
Rushabh Mehta66aa2652013-02-08 15:06:05 +0530123 "columns": ["item.name as name", "item_code", "warehouse",
Nabin Hait30f53462012-12-28 15:39:55 +0530124 "(ifnull(qty, 0) - ifnull(received_qty, 0)) as qty"],
125 "from": "`tabPurchase Order Item` item, `tabPurchase Order` main",
126 "conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
127 "ifnull(warehouse, '')!=''", "ifnull(qty, 0) > ifnull(received_qty, 0)"],
128 "links": {
129 "item_code": ["Item", "name"],
130 "warehouse": ["Warehouse", "name"]
131 },
132 },
Nabin Hait96601592013-01-24 18:24:33 +0530133
Nabin Hait30f53462012-12-28 15:39:55 +0530134 "Sales Order Item": {
Rushabh Mehta66aa2652013-02-08 15:06:05 +0530135 "columns": ["item.name as name", "item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty",
Nabin Hait30f53462012-12-28 15:39:55 +0530136 "reserved_warehouse as warehouse"],
137 "from": "`tabSales Order Item` item, `tabSales Order` main",
138 "conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
139 "ifnull(reserved_warehouse, '')!=''", "ifnull(qty, 0) > ifnull(delivered_qty, 0)"],
140 "links": {
141 "item_code": ["Item", "name"],
142 "warehouse": ["Warehouse", "name"]
143 },
144 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530145
146 # Sales
147 "Customer": {
148 "columns": ["name", "if(customer_name=name, '', customer_name) as customer_name",
149 "customer_group as parent_customer_group", "territory as parent_territory"],
Anand Doshi73519e12012-10-11 14:04:27 +0530150 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530151 "order_by": "name",
152 "links": {
153 "parent_customer_group": ["Customer Group", "name"],
154 "parent_territory": ["Territory", "name"],
155 }
Rushabh Mehta2ad0d422012-09-18 18:52:05 +0530156 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530157 "Customer Group": {
158 "columns": ["name", "parent_customer_group"],
Anand Doshi73519e12012-10-11 14:04:27 +0530159 "conditions": ["docstatus < 2"],
Rushabh Mehta2ad0d422012-09-18 18:52:05 +0530160 "order_by": "lft"
161 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530162 "Territory": {
163 "columns": ["name", "parent_territory"],
Anand Doshi73519e12012-10-11 14:04:27 +0530164 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530165 "order_by": "lft"
166 },
167 "Sales Invoice": {
168 "columns": ["name", "customer", "posting_date", "company"],
169 "conditions": ["docstatus=1"],
170 "order_by": "posting_date",
171 "links": {
172 "customer": ["Customer", "name"],
173 "company":["Company", "name"]
174 }
175 },
176 "Sales Invoice Item": {
Rushabh Mehta677b4b42013-02-07 22:19:47 +0530177 "columns": ["name", "parent", "item_code", "qty", "amount"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530178 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
179 "order_by": "parent",
180 "links": {
181 "parent": ["Sales Invoice", "name"],
182 "item_code": ["Item", "name"]
183 }
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530184 },
Nabin Hait96601592013-01-24 18:24:33 +0530185 "Sales Order": {
186 "columns": ["name", "customer", "transaction_date as posting_date", "company"],
187 "conditions": ["docstatus=1"],
188 "order_by": "transaction_date",
189 "links": {
190 "customer": ["Customer", "name"],
191 "company":["Company", "name"]
192 }
193 },
194 "Sales Order Item[Sales Analytics]": {
Rushabh Mehta677b4b42013-02-07 22:19:47 +0530195 "columns": ["name", "parent", "item_code", "qty", "amount"],
Nabin Hait96601592013-01-24 18:24:33 +0530196 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
197 "order_by": "parent",
198 "links": {
199 "parent": ["Sales Order", "name"],
200 "item_code": ["Item", "name"]
201 }
202 },
203 "Delivery Note": {
204 "columns": ["name", "customer", "posting_date", "company"],
205 "conditions": ["docstatus=1"],
206 "order_by": "posting_date",
207 "links": {
208 "customer": ["Customer", "name"],
209 "company":["Company", "name"]
210 }
211 },
212 "Delivery Note Item[Sales Analytics]": {
Rushabh Mehta677b4b42013-02-07 22:19:47 +0530213 "columns": ["name", "parent", "item_code", "qty", "amount"],
Nabin Hait96601592013-01-24 18:24:33 +0530214 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
215 "order_by": "parent",
216 "links": {
217 "parent": ["Delivery Note", "name"],
218 "item_code": ["Item", "name"]
219 }
220 },
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530221 "Supplier": {
222 "columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
223 "supplier_type as parent_supplier_type"],
Anand Doshi73519e12012-10-11 14:04:27 +0530224 "conditions": ["docstatus < 2"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530225 "order_by": "name",
226 "links": {
227 "parent_supplier_type": ["Supplier Type", "name"],
228 }
229 },
230 "Supplier Type": {
231 "columns": ["name"],
Anand Doshi73519e12012-10-11 14:04:27 +0530232 "conditions": ["docstatus < 2"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530233 "order_by": "name"
234 },
235 "Purchase Invoice": {
236 "columns": ["name", "supplier", "posting_date", "company"],
237 "conditions": ["docstatus=1"],
238 "order_by": "posting_date",
239 "links": {
240 "supplier": ["Supplier", "name"],
241 "company":["Company", "name"]
242 }
243 },
244 "Purchase Invoice Item": {
Rushabh Mehta677b4b42013-02-07 22:19:47 +0530245 "columns": ["name", "parent", "item_code", "qty", "amount"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530246 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
247 "order_by": "parent",
248 "links": {
249 "parent": ["Purchase Invoice", "name"],
250 "item_code": ["Item", "name"]
251 }
Rushabh Mehta607a2212013-01-04 16:42:33 +0530252 },
Nabin Haitd1301c72013-01-24 18:38:30 +0530253 "Purchase Order": {
254 "columns": ["name", "supplier", "transaction_date as posting_date", "company"],
255 "conditions": ["docstatus=1"],
256 "order_by": "posting_date",
257 "links": {
258 "supplier": ["Supplier", "name"],
259 "company":["Company", "name"]
260 }
261 },
262 "Purchase Order Item[Purchase Analytics]": {
Rushabh Mehta677b4b42013-02-07 22:19:47 +0530263 "columns": ["name", "parent", "item_code", "qty", "amount"],
Nabin Haitd1301c72013-01-24 18:38:30 +0530264 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
265 "order_by": "parent",
266 "links": {
267 "parent": ["Purchase Order", "name"],
268 "item_code": ["Item", "name"]
269 }
270 },
271 "Purchase Receipt": {
272 "columns": ["name", "supplier", "posting_date", "company"],
273 "conditions": ["docstatus=1"],
274 "order_by": "posting_date",
275 "links": {
276 "supplier": ["Supplier", "name"],
277 "company":["Company", "name"]
278 }
279 },
280 "Purchase Receipt Item[Purchase Analytics]": {
Rushabh Mehta677b4b42013-02-07 22:19:47 +0530281 "columns": ["name", "parent", "item_code", "qty", "amount"],
Nabin Haitd1301c72013-01-24 18:38:30 +0530282 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
283 "order_by": "parent",
284 "links": {
285 "parent": ["Purchase Receipt", "name"],
286 "item_code": ["Item", "name"]
287 }
288 },
Rushabh Mehta607a2212013-01-04 16:42:33 +0530289 # Support
290 "Support Ticket": {
Rushabh Mehtabe9ef4a2013-01-14 15:48:00 +0530291 "columns": ["name","status","creation","resolution_date","first_responded_on"],
Rushabh Mehta607a2212013-01-04 16:42:33 +0530292 "conditions": ["docstatus < 2"],
293 "order_by": "creation"
Rushabh Mehta95e4e142012-09-13 19:40:56 +0530294 }
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530295
Rushabh Mehta95e4e142012-09-13 19:40:56 +0530296}