mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-20 07:22:13 +00:00
fix: correct validation for depreciation posting date
(cherry picked from commit da4ed90a3e)
This commit is contained in:
@@ -775,11 +775,8 @@ frappe.ui.form.on("Asset Finance Book", {
|
|||||||
|
|
||||||
depreciation_start_date: function (frm, cdt, cdn) {
|
depreciation_start_date: function (frm, cdt, cdn) {
|
||||||
const book = locals[cdt][cdn];
|
const book = locals[cdt][cdn];
|
||||||
if (
|
if (frm.doc.available_for_use_date && book.depreciation_start_date < frm.doc.available_for_use_date) {
|
||||||
frm.doc.available_for_use_date &&
|
frappe.msgprint(__("Depreciation Posting Date cannot be before Available-for-use Date"));
|
||||||
book.depreciation_start_date == frm.doc.available_for_use_date
|
|
||||||
) {
|
|
||||||
frappe.msgprint(__("Depreciation Posting Date should not be equal to Available for Use Date."));
|
|
||||||
book.depreciation_start_date = "";
|
book.depreciation_start_date = "";
|
||||||
frm.refresh_field("finance_books");
|
frm.refresh_field("finance_books");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,10 +267,10 @@ class Asset(AccountsController):
|
|||||||
frappe.throw(_("Available for use date is required"))
|
frappe.throw(_("Available for use date is required"))
|
||||||
|
|
||||||
for d in self.finance_books:
|
for d in self.finance_books:
|
||||||
if d.depreciation_start_date == self.available_for_use_date:
|
if getdate(d.depreciation_start_date) < getdate(self.available_for_use_date):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"Row #{}: Depreciation Posting Date should not be equal to Available for Use Date."
|
"Depreciation Row {0}: Depreciation Posting Date cannot be before Available-for-use Date"
|
||||||
).format(d.idx),
|
).format(d.idx),
|
||||||
title=_("Incorrect Date"),
|
title=_("Incorrect Date"),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user