fix: Replace edit_dates with flags.increase_in_asset_life
This commit is contained in:
		
							parent
							
								
									ae8cb335b6
								
							
						
					
					
						commit
						bd1796cbb6
					
				| @ -54,7 +54,6 @@ | |||||||
|   "section_break_14", |   "section_break_14", | ||||||
|   "schedules", |   "schedules", | ||||||
|   "to_date", |   "to_date", | ||||||
|   "edit_dates", |  | ||||||
|   "insurance_details", |   "insurance_details", | ||||||
|   "policy_number", |   "policy_number", | ||||||
|   "insurer", |   "insurer", | ||||||
| @ -488,12 +487,6 @@ | |||||||
|    "fieldtype": "Date", |    "fieldtype": "Date", | ||||||
|    "hidden": 1, |    "hidden": 1, | ||||||
|    "label": "To Date" |    "label": "To Date" | ||||||
|   }, |  | ||||||
|   { |  | ||||||
|    "fieldname": "edit_dates", |  | ||||||
|    "fieldtype": "Data", |  | ||||||
|    "hidden": 1, |  | ||||||
|    "label": "Edit Dates" |  | ||||||
|   } |   } | ||||||
|  ], |  ], | ||||||
|  "idx": 72, |  "idx": 72, | ||||||
| @ -516,7 +509,7 @@ | |||||||
|    "link_fieldname": "asset" |    "link_fieldname": "asset" | ||||||
|   } |   } | ||||||
|  ], |  ], | ||||||
|  "modified": "2021-06-17 12:59:39.189106", |  "modified": "2021-06-19 13:56:58.450182", | ||||||
|  "modified_by": "Administrator", |  "modified_by": "Administrator", | ||||||
|  "module": "Assets", |  "module": "Assets", | ||||||
|  "name": "Asset", |  "name": "Asset", | ||||||
|  | |||||||
| @ -223,7 +223,7 @@ class Asset(AccountsController): | |||||||
| 
 | 
 | ||||||
| 				# For last row | 				# For last row | ||||||
| 				elif has_pro_rata and n == cint(number_of_pending_depreciations) - 1: | 				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, | 						self.to_date = add_months(self.available_for_use_date, | ||||||
| 							n * cint(d.frequency_of_depreciation)) | 							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 row.depreciation_method in ("Straight Line", "Manual"): | ||||||
| 		# if the Depreciation Schedule is being prepared for the first time | 		# 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) - | 			depreciation_amount = (flt(row.value_after_depreciation) - | ||||||
| 				flt(row.expected_value_after_useful_life)) / depreciation_left | 				flt(row.expected_value_after_useful_life)) / depreciation_left | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -162,7 +162,7 @@ class AssetRepair(AccountsController): | |||||||
| 		for row in asset.finance_books: | 		for row in asset.finance_books: | ||||||
| 			row.total_number_of_depreciations += self.increase_in_asset_life/row.frequency_of_depreciation | 			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 | 			extra_months = self.increase_in_asset_life % row.frequency_of_depreciation | ||||||
| 			if extra_months != 0: | 			if extra_months != 0: | ||||||
| 				self.calculate_last_schedule_date(asset, row, extra_months) | 				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 | 	# 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): | 	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) - \ | 		number_of_pending_depreciations = cint(row.total_number_of_depreciations) - \ | ||||||
| 			cint(asset.number_of_depreciations_booked) | 			cint(asset.number_of_depreciations_booked) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -835,7 +835,7 @@ def get_depreciation_amount(asset, depreciable_value, row): | |||||||
| 
 | 
 | ||||||
| 	if row.depreciation_method in ("Straight Line", "Manual"): | 	if row.depreciation_method in ("Straight Line", "Manual"): | ||||||
| 		# if the Depreciation Schedule is being prepared for the first time | 		# 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) - | 			depreciation_amount = (flt(row.value_after_depreciation) - | ||||||
| 				flt(row.expected_value_after_useful_life)) / depreciation_left | 				flt(row.expected_value_after_useful_life)) / depreciation_left | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user