Validation for purchase_date

Separate validation for purchase date.
This commit is contained in:
nick9822 2017-02-16 16:26:38 +05:30 committed by GitHub
parent e5cb3e34fe
commit 23e174c270

View File

@ -80,8 +80,11 @@ class Asset(Document):
if cint(self.number_of_depreciations_booked) > cint(self.total_number_of_depreciations):
frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
frappe.msgprint(_("Next Depreciation Date is entered as past date"), title=_('Warning'), indicator='red')
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(self.purchase_date):
frappe.msgprint(_("Next Depreciation Date is entered as past date"))
frappe.throw(_("Next Depreciation Date cannot be before Purchase Date"))
if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life)
and not self.next_depreciation_date):