From c8806e7f787b3040d1c8e2e16b24eca679e37e56 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Fri, 11 May 2018 11:11:17 +0200 Subject: [PATCH] Do not recompute asset end_date if it is already set issue7422 review50331002 --- asset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asset.py b/asset.py index 425058f010..be382ccffb 100644 --- a/asset.py +++ b/asset.py @@ -304,7 +304,8 @@ class Asset(Workflow, ModelSQL, ModelView): @fields.depends('end_date', 'product', 'start_date') def on_change_with_end_date(self): - if all(getattr(self, k, None) for k in ('product', 'start_date')): + if (all(getattr(self, k, None) for k in ('product', 'start_date')) + and not self.end_date): if self.product.depreciation_duration: duration = relativedelta.relativedelta( months=int(self.product.depreciation_duration), days=-1)