Browse Source

[FIX] contract: Use get_relative_delta by default in migration _init_last_date_invoiced

pull/430/head
Sergio Teruel 5 years ago
parent
commit
b416ae059f
  1. 5
      contract/models/contract_line.py

5
contract/models/contract_line.py

@ -602,8 +602,9 @@ class ContractLine(models.Model):
def _init_last_date_invoiced(self): def _init_last_date_invoiced(self):
"""Used to init last_date_invoiced for migration purpose""" """Used to init last_date_invoiced for migration purpose"""
for rec in self: 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': if rec.recurring_rule_type == 'monthlylastday':
last_date_invoiced = ( last_date_invoiced = (

Loading…
Cancel
Save