Add indexes in some transaction doctypes (#9889)

This commit is contained in:
Nabin Hait 2017-07-17 13:28:27 +05:30 committed by Makarand Bauskar
parent 2df7db0346
commit e06526ffff
7 changed files with 28 additions and 3 deletions

View File

@ -11,3 +11,6 @@ from erpnext.controllers.print_settings import print_settings_for_item_table
class PurchaseOrderItem(Document):
def __setup__(self):
print_settings_for_item_table(self)
def on_doctype_update():
frappe.db.add_index("Purchase Order Item", ["item_code", "warehouse"])

View File

@ -8,3 +8,6 @@ from frappe.model.document import Document
class ProductionOrderItem(Document):
pass
def on_doctype_update():
frappe.db.add_index("Production Order Item", ["item_code", "source_warehouse"])

View File

@ -416,4 +416,5 @@ erpnext.patches.v8_0.update_production_orders
erpnext.patches.v8_1.remove_sales_invoice_from_returned_serial_no
erpnext.patches.v8_1.allow_invoice_copy_to_edit_after_submit
erpnext.patches.v8_1.add_hsn_sac_codes
erpnext.patches.v8_1.update_gst_state
erpnext.patches.v8_1.update_gst_state
erpnext.patches.v8_1.add_indexes_in_transaction_doctypes

View File

@ -0,0 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
def execute():
for dt in ("Sales Order Item", "Purchase Order Item",
"Material Request Item", "Production Order Item", "Packed Item"):
frappe.get_doc("DocType", dt).run_module_method("on_doctype_update")

View File

@ -10,3 +10,6 @@ from erpnext.controllers.print_settings import print_settings_for_item_table
class SalesOrderItem(Document):
def __setup__(self):
print_settings_for_item_table(self)
def on_doctype_update():
frappe.db.add_index("Sales Order Item", ["item_code", "warehouse"])

View File

@ -9,4 +9,7 @@ import frappe
from frappe.model.document import Document
class MaterialRequestItem(Document):
pass
pass
def on_doctype_update():
frappe.db.add_index("Material Request Item", ["item_code", "warehouse"])

View File

@ -103,4 +103,7 @@ def get_items_from_product_bundle(args):
})
items.append(get_item_details(args))
return items
return items
def on_doctype_update():
frappe.db.add_index("Packed Item", ["item_code", "warehouse"])