Skip to content

Commit

Permalink
[FIX][16.0][contract] Fix issue on last_date_invoice field on multipl…
Browse files Browse the repository at this point in the history
…e contract lines
  • Loading branch information
MTantin committed Sep 5, 2024
1 parent d17cd32 commit a460edd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contract/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def _prepare_recurring_invoices_values(self, date_ref=False):
)
invoices_values.append(invoice_vals)
# Force the recomputation of journal items
contract_lines._update_recurring_next_date()
contract_lines._update_recurring_next_date(date_ref)
return invoices_values

def recurring_create_invoice(self):
Expand Down
9 changes: 8 additions & 1 deletion contract/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,18 @@ def _insert_markers(self, first_date_invoiced, last_date_invoiced):
name = name.replace("#END#", last_date_invoiced.strftime(date_format))
return name

def _update_recurring_next_date(self):
def _update_recurring_next_date(self, invoicing_date=False):
# FIXME: Change method name according to real updated field
# e.g.: _update_last_date_invoiced()
for rec in self:
last_date_invoiced = rec.next_period_date_end
if invoicing_date:
last_date_invoiced = self.get_next_period_date_end(
invoicing_date,
rec.recurring_rule_type,
rec.recurring_interval,
rec.date_end,
)
rec.write(
{
"last_date_invoiced": last_date_invoiced,
Expand Down

0 comments on commit a460edd

Please sign in to comment.