Skip to content

Commit

Permalink
chore: release version 15.39.1 (#43800)
Browse files Browse the repository at this point in the history
* fix: map doc from purchase order

(cherry picked from commit 60ceb91)

* test: auto create purchase receipt

(cherry picked from commit 59887bb)

* fix: better implementation, handle missing purchase order

(cherry picked from commit 66211da)

* perf: performance optimizations for accounting reports by refactoring account closing balance and period closing voucher (#43798)

* fix: Gl Entry form cleanup

* fix: Added indexes in gl entry table

* perf: Refactored period closing voucher to handle large volume of gle

* fix: fixes as per new period start and end date fields in PCV

* perf: performance optimization for  accounting reports

* perf: performance optimizations for account closing balance patch

* fix: test cases

* fix: lenter issues - direct use of sql query

* fix: test cases

* fix: test cases

* fix: test cases

* fix: wrong fieldname

* fix: test cases

---------

Co-authored-by: Ninad1306 <[email protected]>
Co-authored-by: Smit Vora <[email protected]>
  • Loading branch information
3 people authored Oct 23, 2024
1 parent e0a45a5 commit d392660
Show file tree
Hide file tree
Showing 27 changed files with 843 additions and 554 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def get_previous_closing_entries(company, closing_date, accounting_dimensions):
entries = []
last_period_closing_voucher = frappe.db.get_all(
"Period Closing Voucher",
filters={"docstatus": 1, "company": company, "posting_date": ("<", closing_date)},
filters={"docstatus": 1, "company": company, "period_end_date": ("<", closing_date)},
fields=["name"],
order_by="posting_date desc",
order_by="period_end_date desc",
limit=1,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def validate_accounting_period_on_doc_save(doc, method=None):
date = doc.available_for_use_date
elif doc.doctype == "Asset Repair":
date = doc.completion_date
elif doc.doctype == "Period Closing Voucher":
date = doc.period_end_date
else:
date = doc.posting_date

Expand Down
106 changes: 86 additions & 20 deletions erpnext/accounts/doctype/gl_entry/gl_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,50 @@
"document_type": "Document",
"engine": "InnoDB",
"field_order": [
"dates_section",
"posting_date",
"transaction_date",
"column_break_avko",
"fiscal_year",
"due_date",
"account_details_section",
"account",
"party_type",
"party",
"cost_center",
"debit",
"credit",
"account_currency",
"debit_in_account_currency",
"credit_in_account_currency",
"column_break_ifvf",
"against",
"against_voucher_type",
"against_voucher",
"party_type",
"party",
"transaction_details_section",
"voucher_type",
"voucher_subtype",
"voucher_no",
"voucher_subtype",
"transaction_currency",
"column_break_dpsx",
"against_voucher_type",
"against_voucher",
"voucher_detail_no",
"transaction_exchange_rate",
"amounts_section",
"debit_in_account_currency",
"debit",
"debit_in_transaction_currency",
"column_break_bm1w",
"credit_in_account_currency",
"credit",
"credit_in_transaction_currency",
"dimensions_section",
"cost_center",
"column_break_lmnm",
"project",
"remarks",
"more_info_section",
"finance_book",
"company",
"is_opening",
"is_advance",
"fiscal_year",
"company",
"finance_book",
"column_break_8abq",
"to_rename",
"due_date",
"is_cancelled",
"transaction_currency",
"debit_in_transaction_currency",
"credit_in_transaction_currency",
"transaction_exchange_rate"
"remarks"
],
"fields": [
{
Expand Down Expand Up @@ -285,13 +297,67 @@
"fieldname": "voucher_subtype",
"fieldtype": "Small Text",
"label": "Voucher Subtype"
},
{
"fieldname": "dates_section",
"fieldtype": "Section Break",
"label": "Dates"
},
{
"fieldname": "column_break_avko",
"fieldtype": "Column Break"
},
{
"fieldname": "account_details_section",
"fieldtype": "Section Break",
"label": "Account Details"
},
{
"fieldname": "column_break_ifvf",
"fieldtype": "Column Break"
},
{
"fieldname": "transaction_details_section",
"fieldtype": "Section Break",
"label": "Transaction Details"
},
{
"fieldname": "amounts_section",
"fieldtype": "Section Break",
"label": "Amounts"
},
{
"fieldname": "column_break_dpsx",
"fieldtype": "Column Break"
},
{
"fieldname": "more_info_section",
"fieldtype": "Section Break",
"label": "More Info"
},
{
"fieldname": "column_break_bm1w",
"fieldtype": "Column Break"
},
{
"fieldname": "dimensions_section",
"fieldtype": "Section Break",
"label": "Dimensions"
},
{
"fieldname": "column_break_lmnm",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_8abq",
"fieldtype": "Column Break"
}
],
"icon": "fa fa-list",
"idx": 1,
"in_create": 1,
"links": [],
"modified": "2024-07-02 14:31:51.496466",
"modified": "2024-08-22 13:03:39.997475",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GL Entry",
Expand Down
3 changes: 2 additions & 1 deletion erpnext/accounts/doctype/gl_entry/gl_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,9 @@ def update_against_account(voucher_type, voucher_no):


def on_doctype_update():
frappe.db.add_index("GL Entry", ["against_voucher_type", "against_voucher"])
frappe.db.add_index("GL Entry", ["voucher_type", "voucher_no"])
frappe.db.add_index("GL Entry", ["posting_date", "company"])
frappe.db.add_index("GL Entry", ["party_type", "party"])


def rename_gle_sle_docs():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1986,13 +1986,15 @@ def make_period_closing_voucher(company, cost_center, posting_date=None, submit=
parent_account=parent_account,
doctype="Account",
)
fy = get_fiscal_year(posting_date, company=company)
pcv = frappe.get_doc(
{
"doctype": "Period Closing Voucher",
"transaction_date": posting_date or today(),
"posting_date": posting_date or today(),
"period_start_date": fy[1],
"period_end_date": fy[2],
"company": company,
"fiscal_year": get_fiscal_year(posting_date or today(), company=company)[0],
"fiscal_year": fy[0],
"cost_center": cost_center,
"closing_account_head": surplus_account,
"remarks": "test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ frappe.ui.form.on("Period Closing Voucher", {
});
},

fiscal_year: function (frm) {
if (frm.doc.fiscal_year) {
frappe.call({
method: "erpnext.accounts.doctype.period_closing_voucher.period_closing_voucher.get_period_start_end_date",
args: {
fiscal_year: frm.doc.fiscal_year,
company: frm.doc.company,
},
callback: function (r) {
if (r.message) {
frm.set_value("period_start_date", r.message[0]);
frm.set_value("period_end_date", r.message[1]);
}
},
});
}
},

refresh: function (frm) {
if (frm.doc.docstatus > 0) {
frm.add_custom_button(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,32 @@
"engine": "InnoDB",
"field_order": [
"transaction_date",
"posting_date",
"company",
"fiscal_year",
"year_start_date",
"period_start_date",
"period_end_date",
"amended_from",
"company",
"column_break1",
"closing_account_head",
"remarks",
"gle_processing_status",
"remarks",
"error_message"
],
"fields": [
{
"default": "Today",
"fieldname": "transaction_date",
"fieldtype": "Date",
"label": "Transaction Date",
"oldfieldname": "transaction_date",
"oldfieldtype": "Date"
},
{
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting Date",
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"reqd": 1
},
{
"fieldname": "fiscal_year",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Closing Fiscal Year",
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
Expand Down Expand Up @@ -103,16 +96,25 @@
"read_only": 1
},
{
"fieldname": "year_start_date",
"fieldname": "period_end_date",
"fieldtype": "Date",
"label": "Period End Date",
"reqd": 1
},
{
"fieldname": "period_start_date",
"fieldtype": "Date",
"label": "Year Start Date"
"label": "Period Start Date",
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"reqd": 1
}
],
"icon": "fa fa-file-text",
"idx": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-09-11 20:19:11.810533",
"modified": "2024-09-15 17:22:45.291628",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Period Closing Voucher",
Expand Down Expand Up @@ -148,7 +150,7 @@
"write": 1
}
],
"search_fields": "posting_date, fiscal_year",
"search_fields": "fiscal_year, period_start_date, period_end_date",
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
Expand Down
Loading

0 comments on commit d392660

Please sign in to comment.