2015-03-03 09:25:30 +00:00
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2013-08-05 09:29:54 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
2012-09-13 14:10:56 +00:00
|
|
|
|
2012-09-18 08:07:27 +00:00
|
|
|
from __future__ import unicode_literals
|
2012-09-19 06:31:01 +00:00
|
|
|
|
|
|
|
# mappings for table dumps
|
|
|
|
# "remember to add indexes!"
|
|
|
|
|
2012-09-13 14:10:56 +00:00
|
|
|
data_map = {
|
2012-09-21 09:49:40 +00:00
|
|
|
"Company": {
|
|
|
|
"columns": ["name"],
|
|
|
|
"conditions": ["docstatus < 2"]
|
|
|
|
},
|
|
|
|
"Fiscal Year": {
|
2013-11-25 14:21:18 +00:00
|
|
|
"columns": ["name", "year_start_date", "year_end_date"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-21 09:49:40 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
# Accounts
|
2012-09-13 14:10:56 +00:00
|
|
|
"Account": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["name", "parent_account", "lft", "rgt", "report_type",
|
2015-04-23 07:44:17 +00:00
|
|
|
"company", "is_group"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-11-13 07:58:26 +00:00
|
|
|
"order_by": "lft",
|
|
|
|
"links": {
|
|
|
|
"company": ["Company", "name"],
|
|
|
|
}
|
2014-05-29 10:12:23 +00:00
|
|
|
|
2012-09-13 14:10:56 +00:00
|
|
|
},
|
2012-09-17 13:40:36 +00:00
|
|
|
"Cost Center": {
|
2012-09-21 14:16:24 +00:00
|
|
|
"columns": ["name", "lft", "rgt"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-17 13:40:36 +00:00
|
|
|
"order_by": "lft"
|
|
|
|
},
|
2012-09-13 14:10:56 +00:00
|
|
|
"GL Entry": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["name", "account", "posting_date", "cost_center", "debit", "credit",
|
2013-06-24 08:24:16 +00:00
|
|
|
"is_opening", "company", "voucher_type", "voucher_no", "remarks"],
|
2012-09-19 06:31:01 +00:00
|
|
|
"order_by": "posting_date, account",
|
|
|
|
"links": {
|
|
|
|
"account": ["Account", "name"],
|
2012-09-21 14:16:24 +00:00
|
|
|
"company": ["Company", "name"],
|
|
|
|
"cost_center": ["Cost Center", "name"]
|
2012-09-19 06:31:01 +00:00
|
|
|
}
|
2012-09-13 14:10:56 +00:00
|
|
|
},
|
2012-09-21 09:49:40 +00:00
|
|
|
|
|
|
|
# Stock
|
|
|
|
"Item": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["name", "if(item_name=name, '', item_name) as item_name", "description",
|
2016-02-08 06:22:22 +00:00
|
|
|
"item_group as parent_item_group", "stock_uom", "brand", "valuation_method"],
|
2012-12-31 08:00:18 +00:00
|
|
|
# "conditions": ["docstatus < 2"],
|
2012-09-21 09:49:40 +00:00
|
|
|
"order_by": "name",
|
|
|
|
"links": {
|
|
|
|
"parent_item_group": ["Item Group", "name"],
|
2012-12-25 12:34:10 +00:00
|
|
|
"brand": ["Brand", "name"]
|
2012-09-21 09:49:40 +00:00
|
|
|
}
|
2012-09-13 14:10:56 +00:00
|
|
|
},
|
2012-09-21 09:49:40 +00:00
|
|
|
"Item Group": {
|
|
|
|
"columns": ["name", "parent_item_group"],
|
2013-06-24 11:48:24 +00:00
|
|
|
# "conditions": ["docstatus < 2"],
|
2012-09-21 09:49:40 +00:00
|
|
|
"order_by": "lft"
|
|
|
|
},
|
2012-12-25 12:34:10 +00:00
|
|
|
"Brand": {
|
|
|
|
"columns": ["name"],
|
|
|
|
"conditions": ["docstatus < 2"],
|
|
|
|
"order_by": "name"
|
|
|
|
},
|
2013-03-25 11:33:52 +00:00
|
|
|
"Project": {
|
|
|
|
"columns": ["name"],
|
|
|
|
"conditions": ["docstatus < 2"],
|
|
|
|
"order_by": "name"
|
|
|
|
},
|
2012-09-21 09:49:40 +00:00
|
|
|
"Warehouse": {
|
|
|
|
"columns": ["name"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-21 09:49:40 +00:00
|
|
|
"order_by": "name"
|
2012-09-18 13:22:05 +00:00
|
|
|
},
|
|
|
|
"Stock Ledger Entry": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["name", "posting_date", "posting_time", "item_code", "warehouse",
|
2013-03-25 11:33:52 +00:00
|
|
|
"actual_qty as qty", "voucher_type", "voucher_no", "project",
|
2015-11-16 13:35:46 +00:00
|
|
|
"incoming_rate as incoming_rate", "stock_uom", "serial_no",
|
2014-10-07 05:55:04 +00:00
|
|
|
"qty_after_transaction", "valuation_rate"],
|
2019-01-07 16:37:13 +00:00
|
|
|
"order_by": "posting_date, posting_time, creation",
|
2012-09-18 13:22:05 +00:00
|
|
|
"links": {
|
|
|
|
"item_code": ["Item", "name"],
|
2013-03-25 11:33:52 +00:00
|
|
|
"warehouse": ["Warehouse", "name"],
|
|
|
|
"project": ["Project", "name"]
|
2012-09-19 06:31:01 +00:00
|
|
|
},
|
2012-12-28 10:09:55 +00:00
|
|
|
"force_index": "posting_sort_index"
|
2012-09-18 13:22:05 +00:00
|
|
|
},
|
2013-11-15 08:08:23 +00:00
|
|
|
"Serial No": {
|
|
|
|
"columns": ["name", "purchase_rate as incoming_rate"],
|
|
|
|
"conditions": ["docstatus < 2"],
|
|
|
|
"order_by": "name"
|
|
|
|
},
|
2012-12-25 12:34:10 +00:00
|
|
|
"Stock Entry": {
|
|
|
|
"columns": ["name", "purpose"],
|
|
|
|
"conditions": ["docstatus=1"],
|
|
|
|
"order_by": "posting_date, posting_time, name",
|
|
|
|
},
|
2013-02-18 08:19:15 +00:00
|
|
|
"Material Request Item": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["item.name as name", "item_code", "warehouse",
|
2015-11-16 13:35:46 +00:00
|
|
|
"(qty - ordered_qty) as qty"],
|
2013-02-18 08:19:15 +00:00
|
|
|
"from": "`tabMaterial Request Item` item, `tabMaterial Request` main",
|
2013-02-20 13:14:10 +00:00
|
|
|
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
2015-11-16 13:35:46 +00:00
|
|
|
"ifnull(warehouse, '')!=''", "qty > ordered_qty"],
|
2012-12-28 10:09:55 +00:00
|
|
|
"links": {
|
|
|
|
"item_code": ["Item", "name"],
|
|
|
|
"warehouse": ["Warehouse", "name"]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Purchase Order Item": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["item.name as name", "item_code", "warehouse",
|
2017-03-03 09:30:41 +00:00
|
|
|
"(qty - received_qty)*conversion_factor as qty"],
|
2012-12-28 10:09:55 +00:00
|
|
|
"from": "`tabPurchase Order Item` item, `tabPurchase Order` main",
|
2014-05-29 10:12:23 +00:00
|
|
|
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
2015-11-16 13:35:46 +00:00
|
|
|
"ifnull(warehouse, '')!=''", "qty > received_qty"],
|
2012-12-28 10:09:55 +00:00
|
|
|
"links": {
|
|
|
|
"item_code": ["Item", "name"],
|
|
|
|
"warehouse": ["Warehouse", "name"]
|
|
|
|
},
|
|
|
|
},
|
2014-05-29 10:12:23 +00:00
|
|
|
|
2012-12-28 10:09:55 +00:00
|
|
|
"Sales Order Item": {
|
2017-03-03 09:30:41 +00:00
|
|
|
"columns": ["item.name as name", "item_code", "(qty - delivered_qty)*conversion_factor as qty", "warehouse"],
|
2012-12-28 10:09:55 +00:00
|
|
|
"from": "`tabSales Order Item` item, `tabSales Order` main",
|
2014-05-29 10:12:23 +00:00
|
|
|
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
2015-11-16 13:35:46 +00:00
|
|
|
"ifnull(warehouse, '')!=''", "qty > delivered_qty"],
|
2012-12-28 10:09:55 +00:00
|
|
|
"links": {
|
|
|
|
"item_code": ["Item", "name"],
|
|
|
|
"warehouse": ["Warehouse", "name"]
|
|
|
|
},
|
|
|
|
},
|
2012-09-21 09:49:40 +00:00
|
|
|
|
|
|
|
# Sales
|
|
|
|
"Customer": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["name", "if(customer_name=name, '', customer_name) as customer_name",
|
2012-09-21 09:49:40 +00:00
|
|
|
"customer_group as parent_customer_group", "territory as parent_territory"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-21 09:49:40 +00:00
|
|
|
"order_by": "name",
|
|
|
|
"links": {
|
|
|
|
"parent_customer_group": ["Customer Group", "name"],
|
|
|
|
"parent_territory": ["Territory", "name"],
|
|
|
|
}
|
2012-09-18 13:22:05 +00:00
|
|
|
},
|
2012-09-21 09:49:40 +00:00
|
|
|
"Customer Group": {
|
|
|
|
"columns": ["name", "parent_customer_group"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-18 13:22:05 +00:00
|
|
|
"order_by": "lft"
|
|
|
|
},
|
2012-09-21 09:49:40 +00:00
|
|
|
"Territory": {
|
|
|
|
"columns": ["name", "parent_territory"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-21 09:49:40 +00:00
|
|
|
"order_by": "lft"
|
|
|
|
},
|
|
|
|
"Sales Invoice": {
|
|
|
|
"columns": ["name", "customer", "posting_date", "company"],
|
|
|
|
"conditions": ["docstatus=1"],
|
|
|
|
"order_by": "posting_date",
|
|
|
|
"links": {
|
|
|
|
"customer": ["Customer", "name"],
|
|
|
|
"company":["Company", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Sales Invoice Item": {
|
2017-03-03 09:30:41 +00:00
|
|
|
"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
|
2012-09-21 09:49:40 +00:00
|
|
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
|
|
|
"order_by": "parent",
|
|
|
|
"links": {
|
|
|
|
"parent": ["Sales Invoice", "name"],
|
|
|
|
"item_code": ["Item", "name"]
|
|
|
|
}
|
2012-09-21 14:16:24 +00:00
|
|
|
},
|
2013-01-24 12:54:33 +00:00
|
|
|
"Sales Order": {
|
|
|
|
"columns": ["name", "customer", "transaction_date as posting_date", "company"],
|
|
|
|
"conditions": ["docstatus=1"],
|
|
|
|
"order_by": "transaction_date",
|
|
|
|
"links": {
|
|
|
|
"customer": ["Customer", "name"],
|
|
|
|
"company":["Company", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Sales Order Item[Sales Analytics]": {
|
2017-03-03 09:30:41 +00:00
|
|
|
"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
|
2013-01-24 12:54:33 +00:00
|
|
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
|
|
|
"order_by": "parent",
|
|
|
|
"links": {
|
|
|
|
"parent": ["Sales Order", "name"],
|
|
|
|
"item_code": ["Item", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Delivery Note": {
|
|
|
|
"columns": ["name", "customer", "posting_date", "company"],
|
|
|
|
"conditions": ["docstatus=1"],
|
|
|
|
"order_by": "posting_date",
|
|
|
|
"links": {
|
|
|
|
"customer": ["Customer", "name"],
|
|
|
|
"company":["Company", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Delivery Note Item[Sales Analytics]": {
|
2017-03-03 09:30:41 +00:00
|
|
|
"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
|
2013-01-24 12:54:33 +00:00
|
|
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
|
|
|
"order_by": "parent",
|
|
|
|
"links": {
|
|
|
|
"parent": ["Delivery Note", "name"],
|
|
|
|
"item_code": ["Item", "name"]
|
|
|
|
}
|
|
|
|
},
|
2012-09-21 14:16:24 +00:00
|
|
|
"Supplier": {
|
2014-05-29 10:12:23 +00:00
|
|
|
"columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
|
2018-04-19 13:07:29 +00:00
|
|
|
"supplier_group as parent_supplier_group"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-21 14:16:24 +00:00
|
|
|
"order_by": "name",
|
|
|
|
"links": {
|
2018-04-19 13:07:29 +00:00
|
|
|
"parent_supplier_group": ["Supplier Group", "name"],
|
2012-09-21 14:16:24 +00:00
|
|
|
}
|
|
|
|
},
|
2018-04-19 13:07:29 +00:00
|
|
|
"Supplier Group": {
|
2018-04-20 05:37:19 +00:00
|
|
|
"columns": ["name", "parent_supplier_group"],
|
2012-10-11 08:34:27 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
2012-09-21 14:16:24 +00:00
|
|
|
"order_by": "name"
|
|
|
|
},
|
|
|
|
"Purchase Invoice": {
|
|
|
|
"columns": ["name", "supplier", "posting_date", "company"],
|
|
|
|
"conditions": ["docstatus=1"],
|
|
|
|
"order_by": "posting_date",
|
|
|
|
"links": {
|
|
|
|
"supplier": ["Supplier", "name"],
|
|
|
|
"company":["Company", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Purchase Invoice Item": {
|
2017-04-10 11:12:11 +00:00
|
|
|
"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
|
2012-09-21 14:16:24 +00:00
|
|
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
|
|
|
"order_by": "parent",
|
|
|
|
"links": {
|
|
|
|
"parent": ["Purchase Invoice", "name"],
|
|
|
|
"item_code": ["Item", "name"]
|
|
|
|
}
|
2013-01-04 11:12:33 +00:00
|
|
|
},
|
2013-01-24 13:08:30 +00:00
|
|
|
"Purchase Order": {
|
|
|
|
"columns": ["name", "supplier", "transaction_date as posting_date", "company"],
|
|
|
|
"conditions": ["docstatus=1"],
|
|
|
|
"order_by": "posting_date",
|
|
|
|
"links": {
|
|
|
|
"supplier": ["Supplier", "name"],
|
|
|
|
"company":["Company", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Purchase Order Item[Purchase Analytics]": {
|
2017-03-03 09:30:41 +00:00
|
|
|
"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
|
2013-01-24 13:08:30 +00:00
|
|
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
|
|
|
"order_by": "parent",
|
|
|
|
"links": {
|
|
|
|
"parent": ["Purchase Order", "name"],
|
|
|
|
"item_code": ["Item", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Purchase Receipt": {
|
|
|
|
"columns": ["name", "supplier", "posting_date", "company"],
|
2017-09-13 07:22:30 +00:00
|
|
|
"conditions": ["docstatus=1"],
|
2013-01-24 13:08:30 +00:00
|
|
|
"order_by": "posting_date",
|
|
|
|
"links": {
|
|
|
|
"supplier": ["Supplier", "name"],
|
|
|
|
"company":["Company", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Purchase Receipt Item[Purchase Analytics]": {
|
2017-03-03 09:30:41 +00:00
|
|
|
"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
|
2017-09-13 07:22:30 +00:00
|
|
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
2013-01-24 13:08:30 +00:00
|
|
|
"order_by": "parent",
|
|
|
|
"links": {
|
|
|
|
"parent": ["Purchase Receipt", "name"],
|
|
|
|
"item_code": ["Item", "name"]
|
|
|
|
}
|
|
|
|
},
|
2013-01-04 11:12:33 +00:00
|
|
|
# Support
|
2014-11-28 06:15:02 +00:00
|
|
|
"Issue": {
|
2013-01-14 10:18:00 +00:00
|
|
|
"columns": ["name","status","creation","resolution_date","first_responded_on"],
|
2013-01-04 11:12:33 +00:00
|
|
|
"conditions": ["docstatus < 2"],
|
|
|
|
"order_by": "creation"
|
2017-02-04 22:25:53 +00:00
|
|
|
},
|
2014-05-29 10:12:23 +00:00
|
|
|
|
2017-02-04 22:25:53 +00:00
|
|
|
# Manufacturing
|
2018-03-20 07:08:43 +00:00
|
|
|
"Work Order": {
|
2017-02-07 04:58:25 +00:00
|
|
|
"columns": ["name","status","creation","planned_start_date","planned_end_date","status","actual_start_date","actual_end_date", "modified"],
|
2017-02-04 22:25:53 +00:00
|
|
|
"conditions": ["docstatus = 1"],
|
|
|
|
"order_by": "creation"
|
2017-09-13 07:22:30 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
#Medical
|
|
|
|
"Patient": {
|
|
|
|
"columns": ["name", "creation", "owner", "if(patient_name=name, '', patient_name) as patient_name"],
|
|
|
|
"conditions": ["docstatus < 2"],
|
|
|
|
"order_by": "name",
|
|
|
|
"links": {
|
|
|
|
"owner" : ["User", "name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Patient Appointment": {
|
2018-07-16 12:38:53 +00:00
|
|
|
"columns": ["name", "appointment_type", "patient", "practitioner", "appointment_date", "department", "status", "company"],
|
2017-09-13 07:22:30 +00:00
|
|
|
"order_by": "name",
|
|
|
|
"links": {
|
2018-07-16 12:38:53 +00:00
|
|
|
"practitioner": ["Healthcare Practitioner", "name"],
|
2017-09-13 07:22:30 +00:00
|
|
|
"appointment_type": ["Appointment Type", "name"]
|
|
|
|
}
|
|
|
|
},
|
2018-07-16 12:38:53 +00:00
|
|
|
"Healthcare Practitioner": {
|
2017-09-13 07:22:30 +00:00
|
|
|
"columns": ["name", "department"],
|
|
|
|
"order_by": "name",
|
|
|
|
"links": {
|
|
|
|
"department": ["Department", "name"],
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
"Appointment Type": {
|
|
|
|
"columns": ["name"],
|
|
|
|
"order_by": "name"
|
|
|
|
},
|
|
|
|
"Medical Department": {
|
|
|
|
"columns": ["name"],
|
|
|
|
"order_by": "name"
|
2017-02-04 22:25:53 +00:00
|
|
|
}
|
2012-09-13 14:10:56 +00:00
|
|
|
}
|