Merge pull request #31537 from ruthra-kumar/add_index_to_payment_ledger

refactor: create index for payment ledger
This commit is contained in:
ruthra kumar 2022-07-21 12:50:39 +05:30 committed by GitHub
commit 739d328412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -40,19 +40,22 @@
"fieldname": "account", "fieldname": "account",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Account", "label": "Account",
"options": "Account" "options": "Account",
"search_index": 1
}, },
{ {
"fieldname": "party_type", "fieldname": "party_type",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Party Type", "label": "Party Type",
"options": "DocType" "options": "DocType",
"search_index": 1
}, },
{ {
"fieldname": "party", "fieldname": "party",
"fieldtype": "Dynamic Link", "fieldtype": "Dynamic Link",
"label": "Party", "label": "Party",
"options": "party_type" "options": "party_type",
"search_index": 1
}, },
{ {
"fieldname": "voucher_type", "fieldname": "voucher_type",
@ -114,7 +117,8 @@
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Company", "label": "Company",
"options": "Company" "options": "Company",
"search_index": 1
}, },
{ {
"fieldname": "cost_center", "fieldname": "cost_center",
@ -137,7 +141,7 @@
"in_create": 1, "in_create": 1,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-05-30 19:04:55.532171", "modified": "2022-07-11 09:13:54.379168",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Ledger Entry", "name": "Payment Ledger Entry",

View File

@ -147,3 +147,8 @@ class PaymentLedgerEntry(Document):
update_voucher_outstanding( update_voucher_outstanding(
self.against_voucher_type, self.against_voucher_no, self.account, self.party_type, self.party self.against_voucher_type, self.against_voucher_no, self.account, self.party_type, self.party
) )
def on_doctype_update():
frappe.db.add_index("Payment Ledger Entry", ["against_voucher_no", "against_voucher_type"])
frappe.db.add_index("Payment Ledger Entry", ["voucher_no", "voucher_type"])