Merge pull request #36116 from barredterra/local-holidays
diff --git a/.github/workflows/release_notes.yml b/.github/workflows/release_notes.yml
index 91139de..e765a66 100644
--- a/.github/workflows/release_notes.yml
+++ b/.github/workflows/release_notes.yml
@@ -29,9 +29,9 @@
steps:
- name: Update notes
run: |
- NEW_NOTES=$(gh api --method POST -H "Accept: application/vnd.github+json" /repos/frappe/frappe/releases/generate-notes -f tag_name=$RELEASE_TAG | jq -r '.body' | sed -E '/^\* (chore|ci|test|docs|style)/d' )
- RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" /repos/frappe/frappe/releases/tags/$RELEASE_TAG | jq -r '.id')
- gh api --method PATCH -H "Accept: application/vnd.github+json" /repos/frappe/frappe/releases/$RELEASE_ID -f body="$NEW_NOTES"
+ NEW_NOTES=$(gh api --method POST -H "Accept: application/vnd.github+json" /repos/frappe/erpnext/releases/generate-notes -f tag_name=$RELEASE_TAG | jq -r '.body' | sed -E '/^\* (chore|ci|test|docs|style)/d' )
+ RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" /repos/frappe/erpnext/releases/tags/$RELEASE_TAG | jq -r '.id')
+ gh api --method PATCH -H "Accept: application/vnd.github+json" /repos/frappe/erpnext/releases/$RELEASE_ID -f body="$NEW_NOTES"
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
index 81ff6a5..15c84d4 100644
--- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
+++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
@@ -271,6 +271,12 @@
as_dict=1,
)
+ if isinstance(with_cost_center_and_project, str):
+ if with_cost_center_and_project.lower().strip() == "true":
+ with_cost_center_and_project = True
+ else:
+ with_cost_center_and_project = False
+
if with_cost_center_and_project:
dimension_filters.extend(
[
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index d51c4c4..7a8b7dc 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -159,6 +159,8 @@
accounting_dimensions,
period_closing_voucher=last_period_closing_voucher[0].name,
)
+
+ # Report getting generate from the mid of a fiscal year
if getdate(last_period_closing_voucher[0].posting_date) < getdate(
add_days(filters.from_date, -1)
):
@@ -220,7 +222,10 @@
if start_date:
opening_balance = opening_balance.where(closing_balance.posting_date >= start_date)
opening_balance = opening_balance.where(closing_balance.is_opening == "No")
- opening_balance = opening_balance.where(closing_balance.posting_date < filters.from_date)
+ else:
+ opening_balance = opening_balance.where(
+ (closing_balance.posting_date < filters.from_date) | (closing_balance.is_opening == "Yes")
+ )
if (
not filters.show_unclosed_fy_pl_balances
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index b3b9bc6..f9d9ebb 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -317,7 +317,7 @@
erpnext.patches.v15_0.update_asset_value_for_manual_depr_entries
erpnext.patches.v15_0.update_gpa_and_ndb_for_assdeprsch
erpnext.patches.v14_0.create_accounting_dimensions_for_closing_balance
-erpnext.patches.v14_0.update_closing_balances #17-05-2023
+erpnext.patches.v14_0.update_closing_balances #14-07-2023
execute:frappe.db.set_single_value("Accounts Settings", "merge_similar_account_heads", 0)
# below migration patches should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
diff --git a/erpnext/patches/v14_0/update_closing_balances.py b/erpnext/patches/v14_0/update_closing_balances.py
index d664677..2947b98 100644
--- a/erpnext/patches/v14_0/update_closing_balances.py
+++ b/erpnext/patches/v14_0/update_closing_balances.py
@@ -13,56 +13,63 @@
def execute():
frappe.db.truncate("Account Closing Balance")
- i = 0
- company_wise_order = {}
- for pcv in frappe.db.get_all(
- "Period Closing Voucher",
- fields=["company", "posting_date", "name"],
- filters={"docstatus": 1},
- order_by="posting_date",
- ):
+ for company in frappe.get_all("Company", pluck="name"):
+ i = 0
+ company_wise_order = {}
+ for pcv in frappe.db.get_all(
+ "Period Closing Voucher",
+ fields=["company", "posting_date", "name"],
+ filters={"docstatus": 1, "company": company},
+ order_by="posting_date",
+ ):
- company_wise_order.setdefault(pcv.company, [])
- if pcv.posting_date not in company_wise_order[pcv.company]:
- pcv_doc = frappe.get_doc("Period Closing Voucher", pcv.name)
- pcv_doc.year_start_date = get_fiscal_year(
- pcv.posting_date, pcv.fiscal_year, company=pcv.company
- )[1]
+ company_wise_order.setdefault(pcv.company, [])
+ if pcv.posting_date not in company_wise_order[pcv.company]:
+ pcv_doc = frappe.get_doc("Period Closing Voucher", pcv.name)
+ pcv_doc.year_start_date = get_fiscal_year(
+ pcv.posting_date, pcv.fiscal_year, company=pcv.company
+ )[1]
- # get gl entries against pcv
- gl_entries = frappe.db.get_all(
- "GL Entry", filters={"voucher_no": pcv.name, "is_cancelled": 0}, fields=["*"]
- )
- for entry in gl_entries:
- entry["is_period_closing_voucher_entry"] = 1
- entry["closing_date"] = pcv_doc.posting_date
- entry["period_closing_voucher"] = pcv_doc.name
-
- # get all gl entries for the year
- closing_entries = frappe.db.get_all(
- "GL Entry",
- filters={
- "is_cancelled": 0,
- "voucher_no": ["!=", pcv.name],
- "posting_date": ["between", [pcv_doc.year_start_date, pcv.posting_date]],
- "is_opening": "No",
- },
- fields=["*"],
- )
-
- if i == 0:
- # add opening entries only for the first pcv
- closing_entries += frappe.db.get_all(
- "GL Entry",
- filters={"is_cancelled": 0, "is_opening": "Yes"},
- fields=["*"],
+ # get gl entries against pcv
+ gl_entries = frappe.db.get_all(
+ "GL Entry", filters={"voucher_no": pcv.name, "is_cancelled": 0}, fields=["*"]
)
+ for entry in gl_entries:
+ entry["is_period_closing_voucher_entry"] = 1
+ entry["closing_date"] = pcv_doc.posting_date
+ entry["period_closing_voucher"] = pcv_doc.name
- for entry in closing_entries:
- entry["closing_date"] = pcv_doc.posting_date
- entry["period_closing_voucher"] = pcv_doc.name
+ closing_entries = []
- make_closing_entries(gl_entries + closing_entries, voucher_name=pcv.name)
- company_wise_order[pcv.company].append(pcv.posting_date)
+ if pcv.posting_date not in company_wise_order[pcv.company]:
+ # get all gl entries for the year
+ closing_entries = frappe.db.get_all(
+ "GL Entry",
+ filters={
+ "is_cancelled": 0,
+ "voucher_no": ["!=", pcv.name],
+ "posting_date": ["between", [pcv_doc.year_start_date, pcv.posting_date]],
+ "is_opening": "No",
+ "company": company,
+ },
+ fields=["*"],
+ )
- i += 1
+ if i == 0:
+ # add opening entries only for the first pcv
+ closing_entries += frappe.db.get_all(
+ "GL Entry",
+ filters={"is_cancelled": 0, "is_opening": "Yes", "company": company},
+ fields=["*"],
+ )
+
+ for entry in closing_entries:
+ entry["closing_date"] = pcv_doc.posting_date
+ entry["period_closing_voucher"] = pcv_doc.name
+
+ entries = gl_entries + closing_entries
+
+ if entries:
+ make_closing_entries(entries, voucher_name=pcv.name)
+ i += 1
+ company_wise_order[pcv.company].append(pcv.posting_date)
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index a859a67..8633be8 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -632,7 +632,6 @@
fields.splice(3, 0, {
fieldtype: 'Float',
fieldname: "conversion_factor",
- in_list_view: 1,
label: __("Conversion Factor"),
precision: get_precision('conversion_factor')
})
@@ -640,6 +639,7 @@
new frappe.ui.Dialog({
title: __("Update Items"),
+ size: "extra-large",
fields: [
{
fieldname: "trans_items",