Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this PR fix?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last date invoiced is the last day of the previous period. It can be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a contract with a line that does invoices every 3 months, what is the last date invoiced?? by default the relative delta substract one day, I think that tthis method would be substract all setting contract period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_relative_deltareturn a relative delta based on the contract line invoicing period, so it don't return a relative delta for one day by default.If we have a contract with a line that does invoices every 3 months, the last date invoiced depends on recurring_invoice_type:
for this example
get_relative_deltareturn relativedelta(months=3)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sergio-teruel this method has evolved a bit in #434. Can you check if it solves your issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sbidoul I think is ok, my issue was when I do a migration form old version. If I have a processed contract with this settings ( Invoice every 3 months and pre-paid ) and the date of last invoice was 10/05/2019, after run migration script (12.0.4.0.0), the last invoice date in contract line is 01/04/2020, the correct date is 10/05/2019...


The reason was _init_last_date_invoiced method always subtract one day, I think that this method should be substract all period instead...
But with lastest changes i think that the issue is solved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that I can close this PR