From b416ae059f9f28f38c7ec78e89e93cf8af69e69f Mon Sep 17 00:00:00 2001 From: Sergio Teruel Date: Wed, 27 Nov 2019 13:40:25 +0100 Subject: [PATCH] [FIX] contract: Use get_relative_delta by default in migration _init_last_date_invoiced --- contract/models/contract_line.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contract/models/contract_line.py b/contract/models/contract_line.py index 3178f240..5481fc79 100644 --- a/contract/models/contract_line.py +++ b/contract/models/contract_line.py @@ -602,8 +602,9 @@ class ContractLine(models.Model): def _init_last_date_invoiced(self): """Used to init last_date_invoiced for migration purpose""" for rec in self: - last_date_invoiced = rec.recurring_next_date - relativedelta( - days=1 + last_date_invoiced = ( + rec.recurring_next_date - self.get_relative_delta( + rec.recurring_rule_type, rec.recurring_interval) ) if rec.recurring_rule_type == 'monthlylastday': last_date_invoiced = (