Do not recompute asset end_date if it is already set

issue7422
review50331002
This commit is contained in:
Sergi Almacellas Abellana committed 2018-05-11 11:11:17 +02:00
1 parent 3fdce369fd
commit c8806e7f78
1 file changed
+2 -1
+2 -1
View File
@@ -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)