Multiple fixes in asset
This commit is contained in:
parent
4ea97c84ac
commit
e6acd4c57a
@ -157,6 +157,13 @@ frappe.ui.form.on('Asset', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
available_for_use_date: function(frm) {
|
||||||
|
$.each(frm.doc.finance_books || [], function(i, d) {
|
||||||
|
if(!d.depreciation_start_date) d.depreciation_start_date = frm.doc.available_for_use_date;
|
||||||
|
});
|
||||||
|
refresh_field("finance_books");
|
||||||
|
},
|
||||||
|
|
||||||
is_existing_asset: function(frm) {
|
is_existing_asset: function(frm) {
|
||||||
// frm.toggle_reqd("next_depreciation_date", (!frm.doc.is_existing_asset && frm.doc.calculate_depreciation));
|
// frm.toggle_reqd("next_depreciation_date", (!frm.doc.is_existing_asset && frm.doc.calculate_depreciation));
|
||||||
},
|
},
|
||||||
|
@ -51,7 +51,7 @@ class Asset(AccountsController):
|
|||||||
|
|
||||||
def validate_in_use_date(self):
|
def validate_in_use_date(self):
|
||||||
if not self.available_for_use_date:
|
if not self.available_for_use_date:
|
||||||
frappe.throw(_("Available for use data is required"))
|
frappe.throw(_("Available for use date is required"))
|
||||||
|
|
||||||
def set_missing_values(self):
|
def set_missing_values(self):
|
||||||
if not self.asset_category:
|
if not self.asset_category:
|
||||||
@ -162,6 +162,9 @@ class Asset(AccountsController):
|
|||||||
frappe.throw(_("Row {0}: Expected Value After Useful Life must be less than Gross Purchase Amount")
|
frappe.throw(_("Row {0}: Expected Value After Useful Life must be less than Gross Purchase Amount")
|
||||||
.format(row.idx))
|
.format(row.idx))
|
||||||
|
|
||||||
|
if not row.depreciation_start_date:
|
||||||
|
frappe.throw(_("Row {0}: Depreciation Start Date is required").format(row.idx))
|
||||||
|
|
||||||
if not self.is_existing_asset:
|
if not self.is_existing_asset:
|
||||||
self.opening_accumulated_depreciation = 0
|
self.opening_accumulated_depreciation = 0
|
||||||
self.number_of_depreciations_booked = 0
|
self.number_of_depreciations_booked = 0
|
||||||
|
@ -55,7 +55,5 @@ class AssetMovement(Document):
|
|||||||
frappe.db.set_value("Asset", self.asset, "location", location)
|
frappe.db.set_value("Asset", self.asset, "location", location)
|
||||||
|
|
||||||
if self.serial_no:
|
if self.serial_no:
|
||||||
serial_nos = get_serial_nos(self.serial_no)
|
for d in get_serial_nos(self.serial_no):
|
||||||
|
frappe.db.set_value('Serial No', d, 'location', location)
|
||||||
frappe.db.sql(""" update `tabSerial No` set location = %s where name in (%s)"""
|
|
||||||
%('%s', ','.join(['%s'] * len(serial_nos))), (location, tuple(serial_nos)))
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user