From 52b284d038bf6eeb05f296d4bdbc44a8da051685 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Mon, 24 Sep 2018 19:46:22 +0200 Subject: [PATCH] fix init flag when computing depreciation board --- account_asset_management/__manifest__.py | 2 +- account_asset_management/models/account_asset.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/account_asset_management/__manifest__.py b/account_asset_management/__manifest__.py index e06ae3faa..5b7c53c33 100644 --- a/account_asset_management/__manifest__.py +++ b/account_asset_management/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Assets Management', - 'version': '10.0.3.0.2', + 'version': '10.0.3.0.3', 'license': 'AGPL-3', 'depends': [ 'account_fiscal_year', diff --git a/account_asset_management/models/account_asset.py b/account_asset_management/models/account_asset.py index e0450cd32..5b90fac91 100644 --- a/account_asset_management/models/account_asset.py +++ b/account_asset_management/models/account_asset.py @@ -895,7 +895,7 @@ class AccountAsset(models.Model): asset_date_start = datetime.strptime(self.date_start, '%Y-%m-%d') fy = company.find_daterange_fy(asset_date_start) fiscalyear_lock_date = company.fiscalyear_lock_date - if fiscalyear_lock_date > self.date_start: + if fiscalyear_lock_date >= self.date_start: init_flag = True if fy: fy_id = fy.id @@ -950,12 +950,17 @@ class AccountAsset(models.Model): fy_date_start = fy_date_stop + relativedelta(days=1) fy = company.find_daterange_fy(fy_date_start) if fy: - if fiscalyear_lock_date > fy.date_end: + if fiscalyear_lock_date >= fy.date_end: init_flag = True + else: + init_flag = False fy_date_stop = datetime.strptime(fy.date_end, '%Y-%m-%d') else: fy_date_stop = fy_date_stop + relativedelta(years=1) - + if fiscalyear_lock_date >= fy_date_stop.strftime('%Y-%m-%d'): + init_flag = True + else: + init_flag = False # Step 1: # Calculate depreciation amount per fiscal year. # This is calculation is skipped for method_time != 'year'.