Skip to content

Commit

Permalink
[IMP] Improved fiscal year generation on unit test (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoC0 authored and eLBati committed Oct 25, 2024
1 parent 3ddd4ce commit a33c972
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions l10n_it_asset_management/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def _depreciate_asset_wizard(
period_count=None,
override_journal=None,
):
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)
if override_journal is None:
override_journal = self.env["account.journal"].browse()
wiz_vals = asset.with_context(
Expand Down Expand Up @@ -326,10 +329,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 + 1,
)
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 a33c972

Please sign in to comment.