Merge pull request #49911 from rehanrehman389/feat/accounting-period-disable

feat: add disabled field to Accounting Period
This commit is contained in:
rohitwaghchaure
2025-10-07 09:19:39 +05:30
committed by GitHub
3 changed files with 15 additions and 2 deletions

View File

@@ -11,6 +11,7 @@
"end_date",
"column_break_4",
"company",
"disabled",
"section_break_7",
"closed_documents"
],
@@ -49,6 +50,13 @@
"options": "Company",
"reqd": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Disabled"
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break"
@@ -62,10 +70,11 @@
}
],
"links": [],
"modified": "2024-03-27 13:05:57.388109",
"modified": "2025-10-06 15:00:15.568067",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounting Period",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
@@ -105,8 +114,9 @@
"write": 1
}
],
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
}

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

@@ -159,6 +159,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