fix: Replace edit_dates with flags.increase_in_asset_life
diff --git a/erpnext/assets/doctype/asset/asset.json b/erpnext/assets/doctype/asset/asset.json
index d55258c..d77eb10 100644
--- a/erpnext/assets/doctype/asset/asset.json
+++ b/erpnext/assets/doctype/asset/asset.json
@@ -54,7 +54,6 @@
"section_break_14",
"schedules",
"to_date",
- "edit_dates",
"insurance_details",
"policy_number",
"insurer",
@@ -488,12 +487,6 @@
"fieldtype": "Date",
"hidden": 1,
"label": "To Date"
- },
- {
- "fieldname": "edit_dates",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "Edit Dates"
}
],
"idx": 72,
@@ -516,7 +509,7 @@
"link_fieldname": "asset"
}
],
- "modified": "2021-06-17 12:59:39.189106",
+ "modified": "2021-06-19 13:56:58.450182",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 93b05eb..63b70f6 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -223,7 +223,7 @@
# For last row
elif has_pro_rata and n == cint(number_of_pending_depreciations) - 1:
- if not self.edit_dates:
+ if not self.flags.increase_in_asset_life:
self.to_date = add_months(self.available_for_use_date,
n * cint(d.frequency_of_depreciation))
@@ -789,7 +789,7 @@
if row.depreciation_method in ("Straight Line", "Manual"):
# if the Depreciation Schedule is being prepared for the first time
- if not asset.edit_dates:
+ if not asset.flags.increase_in_asset_life:
depreciation_amount = (flt(row.value_after_depreciation) -
flt(row.expected_value_after_useful_life)) / depreciation_left
diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py
index 0befee7..da237f0 100644
--- a/erpnext/assets/doctype/asset_repair/asset_repair.py
+++ b/erpnext/assets/doctype/asset_repair/asset_repair.py
@@ -162,7 +162,7 @@
for row in asset.finance_books:
row.total_number_of_depreciations += self.increase_in_asset_life/row.frequency_of_depreciation
- asset.edit_dates = ""
+ asset.flags.increase_in_asset_life = False
extra_months = self.increase_in_asset_life % row.frequency_of_depreciation
if extra_months != 0:
self.calculate_last_schedule_date(asset, row, extra_months)
@@ -172,7 +172,7 @@
# to help modify depreciation schedule when increase_in_asset_life is not a multiple of frequency_of_depreciation
def calculate_last_schedule_date(self, asset, row, extra_months):
- asset.edit_dates = "Don't Edit"
+ asset.flags.increase_in_asset_life = True
number_of_pending_depreciations = cint(row.total_number_of_depreciations) - \
cint(asset.number_of_depreciations_booked)
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index 11b19ae..81c0918 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -835,7 +835,7 @@
if row.depreciation_method in ("Straight Line", "Manual"):
# if the Depreciation Schedule is being prepared for the first time
- if not asset.edit_dates:
+ if not asset.flags.increase_in_asset_life:
depreciation_amount = (flt(row.value_after_depreciation) -
flt(row.expected_value_after_useful_life)) / depreciation_left