fix: Replace edit_dates with flags.increase_in_asset_life

This commit is contained in:
GangaManoj 2021-06-19 14:00:26 +05:30
parent ae8cb335b6
commit bd1796cbb6
4 changed files with 6 additions and 13 deletions

View File

@ -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",

View File

@ -223,7 +223,7 @@ class Asset(AccountsController):
# 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 @@ def get_depreciation_amount(asset, depreciable_value, row):
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

View File

@ -162,7 +162,7 @@ class AssetRepair(AccountsController):
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 @@ class AssetRepair(AccountsController):
# 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)

View File

@ -835,7 +835,7 @@ def get_depreciation_amount(asset, depreciable_value, row):
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