blob: 08670f95440476278c1e82ee7243dd28f1deca6f [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",
Anand Doshi73519e12012-10-11 14:04:27 +053029 "adddate(adddate(year_start_date, interval 1 year), interval -1 day) as year_end_date"],
30 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053031 },
32
33 # Accounts
Rushabh Mehta95e4e142012-09-13 19:40:56 +053034 "Account": {
Anand Doshibc243de2012-09-24 18:03:35 +053035 "columns": ["name", "parent_account", "lft", "rgt", "debit_or_credit",
36 "is_pl_account", "company"],
Anand Doshi73519e12012-10-11 14:04:27 +053037 "conditions": ["docstatus < 2"],
Rushabh Mehta95e4e142012-09-13 19:40:56 +053038 "order_by": "lft"
39 },
Rushabh Mehta41565232012-09-17 19:10:36 +053040 "Cost Center": {
Rushabh Mehta09d84b62012-09-21 19:46:24 +053041 "columns": ["name", "lft", "rgt"],
Anand Doshi73519e12012-10-11 14:04:27 +053042 "conditions": ["docstatus < 2"],
Rushabh Mehta41565232012-09-17 19:10:36 +053043 "order_by": "lft"
44 },
Rushabh Mehta95e4e142012-09-13 19:40:56 +053045 "GL Entry": {
46 "columns": ["account", "posting_date", "cost_center", "debit", "credit", "is_opening",
Rushabh Mehtacfb54662012-09-14 18:12:17 +053047 "company", "voucher_type", "voucher_no", "remarks"],
Rushabh Mehta95e4e142012-09-13 19:40:56 +053048 "conditions": ["ifnull(is_cancelled, 'No')='No'"],
Rushabh Mehta823c0212012-09-19 12:01:01 +053049 "order_by": "posting_date, account",
50 "links": {
51 "account": ["Account", "name"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +053052 "company": ["Company", "name"],
53 "cost_center": ["Cost Center", "name"]
Rushabh Mehta823c0212012-09-19 12:01:01 +053054 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +053055 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053056
57 # Stock
58 "Item": {
59 "columns": ["name", "if(item_name=name, '', item_name) as item_name",
Rushabh Mehta09d84b62012-09-21 19:46:24 +053060 "item_group as parent_item_group", "stock_uom", "brand", "valuation_method"],
Anand Doshi73519e12012-10-11 14:04:27 +053061 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053062 "order_by": "name",
63 "links": {
64 "parent_item_group": ["Item Group", "name"],
65 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +053066 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053067 "Item Group": {
68 "columns": ["name", "parent_item_group"],
Anand Doshi73519e12012-10-11 14:04:27 +053069 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053070 "order_by": "lft"
71 },
72 "Warehouse": {
73 "columns": ["name"],
Anand Doshi73519e12012-10-11 14:04:27 +053074 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053075 "order_by": "name"
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053076 },
77 "Stock Ledger Entry": {
78 "columns": ["posting_date", "posting_time", "item_code", "warehouse", "actual_qty as qty",
Rushabh Mehta6ca80542012-09-20 19:03:14 +053079 "voucher_type", "voucher_no", "ifnull(incoming_rate,0) as incoming_rate"],
Rushabh Mehta823c0212012-09-19 12:01:01 +053080 "conditions": ["ifnull(is_cancelled, 'No')='No'"],
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053081 "order_by": "posting_date, posting_time, name",
82 "links": {
83 "item_code": ["Item", "name"],
84 "warehouse": ["Warehouse", "name"]
Rushabh Mehta823c0212012-09-19 12:01:01 +053085 },
86 "force_index": "posting_sort_index"
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053087 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +053088
89 # Sales
90 "Customer": {
91 "columns": ["name", "if(customer_name=name, '', customer_name) as customer_name",
92 "customer_group as parent_customer_group", "territory as parent_territory"],
Anand Doshi73519e12012-10-11 14:04:27 +053093 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +053094 "order_by": "name",
95 "links": {
96 "parent_customer_group": ["Customer Group", "name"],
97 "parent_territory": ["Territory", "name"],
98 }
Rushabh Mehta2ad0d422012-09-18 18:52:05 +053099 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530100 "Customer Group": {
101 "columns": ["name", "parent_customer_group"],
Anand Doshi73519e12012-10-11 14:04:27 +0530102 "conditions": ["docstatus < 2"],
Rushabh Mehta2ad0d422012-09-18 18:52:05 +0530103 "order_by": "lft"
104 },
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530105 "Territory": {
106 "columns": ["name", "parent_territory"],
Anand Doshi73519e12012-10-11 14:04:27 +0530107 "conditions": ["docstatus < 2"],
Rushabh Mehtaf200c522012-09-21 15:19:40 +0530108 "order_by": "lft"
109 },
110 "Sales Invoice": {
111 "columns": ["name", "customer", "posting_date", "company"],
112 "conditions": ["docstatus=1"],
113 "order_by": "posting_date",
114 "links": {
115 "customer": ["Customer", "name"],
116 "company":["Company", "name"]
117 }
118 },
119 "Sales Invoice Item": {
120 "columns": ["parent", "item_code", "qty", "amount"],
121 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
122 "order_by": "parent",
123 "links": {
124 "parent": ["Sales Invoice", "name"],
125 "item_code": ["Item", "name"]
126 }
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530127 },
128 "Supplier": {
129 "columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
130 "supplier_type as parent_supplier_type"],
Anand Doshi73519e12012-10-11 14:04:27 +0530131 "conditions": ["docstatus < 2"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530132 "order_by": "name",
133 "links": {
134 "parent_supplier_type": ["Supplier Type", "name"],
135 }
136 },
137 "Supplier Type": {
138 "columns": ["name"],
Anand Doshi73519e12012-10-11 14:04:27 +0530139 "conditions": ["docstatus < 2"],
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530140 "order_by": "name"
141 },
142 "Purchase Invoice": {
143 "columns": ["name", "supplier", "posting_date", "company"],
144 "conditions": ["docstatus=1"],
145 "order_by": "posting_date",
146 "links": {
147 "supplier": ["Supplier", "name"],
148 "company":["Company", "name"]
149 }
150 },
151 "Purchase Invoice Item": {
152 "columns": ["parent", "item_code", "qty", "amount"],
153 "conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
154 "order_by": "parent",
155 "links": {
156 "parent": ["Purchase Invoice", "name"],
157 "item_code": ["Item", "name"]
158 }
Rushabh Mehta95e4e142012-09-13 19:40:56 +0530159 }
Rushabh Mehta09d84b62012-09-21 19:46:24 +0530160
Rushabh Mehta95e4e142012-09-13 19:40:56 +0530161}