Merge pull request #3480 from nabinhait/develop

Indexes
This commit is contained in:
Nabin Hait 2015-06-16 16:49:26 +05:30
commit 7d100a1ee7
4 changed files with 45 additions and 18 deletions

View File

@ -29,7 +29,8 @@
"options": "Supplier",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
"read_only": 0,
"search_index": 1
},
{
"depends_on": "supplier",
@ -112,7 +113,7 @@
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
"search_index": 0
},
{
"fieldname": "bill_date",
@ -125,7 +126,7 @@
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
"search_index": 0
},
{
"fieldname": "amended_from",
@ -151,7 +152,7 @@
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"search_index": 1
"search_index": 0
},
{
"fieldname": "currency_and_price_list",
@ -556,7 +557,7 @@
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"search_index": 1
"search_index": 0
},
{
"fieldname": "write_off_amount",
@ -733,7 +734,7 @@
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"search_index": 1
"search_index": 0
},
{
"allow_on_submit": 1,
@ -760,7 +761,7 @@
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"search_index": 1
"search_index": 0
},
{
"fieldname": "mode_of_payment",
@ -789,7 +790,7 @@
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"search_index": 1
"search_index": 0
},
{
"fieldname": "remarks",
@ -930,7 +931,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2015-06-15 15:38:19.220184",
"modified": "2015-06-16 16:46:47.308287",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@ -38,7 +38,8 @@
"options": "Customer",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
"read_only": 0,
"search_index": 1
},
{
"depends_on": "customer",
@ -880,7 +881,7 @@
"options": "Project",
"permlevel": 0,
"read_only": 0,
"search_index": 1
"search_index": 0
},
{
"depends_on": "eval:doc.source == 'Campaign'",
@ -1243,7 +1244,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2015-06-15 15:38:08.543029",
"modified": "2015-06-16 16:45:06.618286",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@ -0,0 +1,17 @@
- Performance upgrade in Trial Balance, General Ledger, AR/AP, Balance Sheet and P&L Statement reports
- Add index on Account and GL Entry, Sales Invoice and Purchase Invoice table
- Don't create Time Logs against Production Order if Workstation is not specified in Operations
- Task should be mandatory in Time Log only when Project is mentioned but Production Order is not
- Supplier invoice no unique validation and supplier invoice date can not be after posting date
- Removed BOM No from mandatory from Stock Entry against Production Order
- Load tasks in project for printing purpose
- Added Customers Not Buying Since Long Time against Sales Invoice
- POS - search by Item Group
- Payment period based on invoice date: show party columns and filter based on party
- Barcode added to Purchase Receipt
- Fetch item name and desc on change of item code in Quality Inspection
- Show item name in item grid view based 'In List View' property
- Validate and update manufactured qty in Stock Entry
- Show only users with Expense Approver role in Expense Claim Approver field
- Over Production Allowance Percentage Setting added to Manufacturing Settings
- Activity Cost - Mandatory removed for Employee

View File

@ -5,18 +5,26 @@ import frappe
def execute():
index_map = {
"Account": ["parent_account", "lft", "rgt"],
"GL Entry": ["posting_date", "account", 'party', "voucher_no"]
"GL Entry": ["posting_date", "account", 'party', "voucher_no"],
"Sales Invoice": ["posting_date", "debit_to", "customer"],
"Purchase Invoice": ["posting_date", "credit_to", "supplier"]
}
for dt, indexes in index_map.items():
existing_indexes = [d.Key_name for d in frappe.db.sql("""show index from `tab{0}`
existing_indexes = [(d.Key_name, d.Column_name) for d in frappe.db.sql("""show index from `tab{0}`
where Column_name != 'name'""".format(dt), as_dict=1)]
for old in existing_indexes:
if old in ("parent", "group_or_ledger", "is_pl_account", "debit_or_credit", "account_name", "company"):
for old, column in existing_indexes:
if column in ("parent", "group_or_ledger", "is_group", "is_pl_account", "debit_or_credit",
"account_name", "company", "project_name", "voucher_date", "due_date", "bill_no",
"bill_date", "is_opening", "fiscal_year", "outstanding_amount"):
frappe.db.sql("alter table `tab{0}` drop index {1}".format(dt, old))
existing_indexes.remove(old)
existing_indexes = [(d.Key_name, d.Column_name) for d in frappe.db.sql("""show index from `tab{0}`
where Column_name != 'name'""".format(dt), as_dict=1)]
existing_indexed_columns = list(set([x[1] for x in existing_indexes]))
for new in indexes:
if new not in existing_indexes:
if new not in existing_indexed_columns:
frappe.db.sql("alter table `tab{0}` add index ({1})".format(dt, new))