Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX][16.0][contract] Fix issue on last_date_invoice contract line #1124

Open
wants to merge 4 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = rec.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
2 changes: 0 additions & 2 deletions contract/models/contract_recurrency_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ def _compute_next_period_date_start(self):
"recurring_invoicing_offset",
"recurring_rule_type",
"recurring_interval",
"date_end",
"recurring_next_date",
)
def _compute_next_period_date_end(self):
for rec in self:
Expand Down
Loading