Skip to content

Commit

Permalink
[IMP] Improved fiscal year generation on unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoC0 committed Jun 28, 2024
1 parent 2631262 commit ce16628
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions l10n_it_asset_management/tests/test_assets_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ def _create_asset(self, asset_date):
return asset

def _depreciate_asset(self, asset, date_dep):
first_of_year = date_dep.replace(month=1, day=1)
last_of_year = date_dep.replace(month=12, day=31)
self._generate_fiscal_years(first_of_year, last_of_year)
wiz_vals = asset.with_context(
**{"allow_reload_window": True}
).launch_wizard_generate_depreciations()
Expand Down Expand Up @@ -676,10 +679,9 @@ def _civil_depreciate_asset(self, asset):
return True

def _generate_fiscal_years(self, start_date, end_date):
fiscal_years = range(
start_date.year,
end_date.year,
)
fiscal_years = set()
for year in range(start_date.year, end_date.year + 1):
fiscal_years.add(year)
fiscal_years_values = list()
for fiscal_year in fiscal_years:
fiscal_year_values = {
Expand Down

0 comments on commit ce16628

Please sign in to comment.