feat: add disabled field to Accounting Period

(cherry picked from commit bd928e0d56)

# Conflicts:
#	erpnext/accounts/doctype/accounting_period/accounting_period.json
This commit is contained in:
rehansari26
2025-10-06 16:20:26 +05:30
committed by Mergify
parent 56d04761f8
commit 3fde94fdb7
3 changed files with 80 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
{
<<<<<<< HEAD
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
@@ -12,6 +13,24 @@
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
=======
"actions": [],
"autoname": "field:period_name",
"creation": "2018-04-13 18:50:14.672323",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"period_name",
"start_date",
"end_date",
"column_break_4",
"company",
"disabled",
"section_break_7",
"closed_documents"
],
>>>>>>> bd928e0d56 (feat: add disabled field to Accounting Period)
"fields": [
{
"allow_bulk_edit": 0,
@@ -199,6 +218,7 @@
"unique": 0
},
{
<<<<<<< HEAD
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
@@ -247,6 +267,52 @@
"name": "Accounting Period",
"name_case": "",
"owner": "Administrator",
=======
"fieldname": "end_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "End Date",
"reqd": 1
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"options": "Company",
"reqd": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Disabled"
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break"
},
{
"fieldname": "closed_documents",
"fieldtype": "Table",
"label": "Closed Documents",
"options": "Closed Document",
"reqd": 1
}
],
"links": [],
"modified": "2025-10-06 15:00:15.568067",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounting Period",
"naming_rule": "By fieldname",
"owner": "Administrator",
>>>>>>> bd928e0d56 (feat: add disabled field to Accounting Period)
"permissions": [
{
"amend": 0,
@@ -305,6 +371,7 @@
"submit": 0,
"write": 1
}
<<<<<<< HEAD
],
"quick_entry": 0,
"read_only": 0,
@@ -314,4 +381,13 @@
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
}
}
=======
],
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
>>>>>>> bd928e0d56 (feat: add disabled field to Accounting Period)

View File

@@ -28,6 +28,7 @@ class AccountingPeriod(Document):
closed_documents: DF.Table[ClosedDocument]
company: DF.Link
disabled: DF.Check
end_date: DF.Date
period_name: DF.Data
start_date: DF.Date
@@ -116,6 +117,7 @@ def validate_accounting_period_on_doc_save(doc, method=None):
.where(
(ap.name == cd.parent)
& (ap.company == doc.company)
& (ap.disabled == 0)
& (cd.closed == 1)
& (cd.document_type == doc.doctype)
& (date >= ap.start_date)

View File

@@ -149,6 +149,7 @@ def validate_accounting_period(gl_map):
WHERE
ap.name = cd.parent
AND ap.company = %(company)s
AND ap.disabled = 0
AND cd.closed = 1
AND cd.document_type = %(voucher_type)s
AND %(date)s between ap.start_date and ap.end_date