[FIX][16.0][contract] Fix issue on last_date_invoice contract line #1124
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.
Module
contract
Describe the bug
On multiline reccuring contract, the contract line last_date_invoice field is correct on the first line and is shift by 1 period time on the others lines (verified in database). This issue generate visible bug only when #START keywork is used in line note.
To Reproduce
Expected behavior
Have correct date in #START and #END keywords of line notes
Correction
The bug came from
_update_recurring_next_date
method. This method is usingnext_period_date_end
field to filllast_date_invoiced
field butlast_date_invoiced
is used to recomputerecurring_next_date
of contract and impactnext_period_date_end
. So the first line is correctly edited but the next line use the newrecurring_next_date
and it create a shift for the next lines.I keep the older mechanism of
_update_recurring_next_date
withoutinvoicing_date
and i've add a new mechanism with a specifiedinvoicing_date
to use the actual invoicing date.