contract
contract copied to clipboard
[16.0][IMP] contract: Big changes in recurrency fields
Modules instaled:
- contract
- contract_sale
- contract_sale_generation
Description of the problem(s): TO report this problem, I changed to invisible fields to visible in the view in order to see ther error better. We have made all the screenshots generating invoices, but it also occurs when generating sales.
Problem 1
If you add the products and then you change the recurrency (for exemple Every 1 week), the recurrency fields are not updated correctly.
-
We add a product.
-
We change the recurrency
-
We save and we create 3 invoices
As we can see, the recurrence is every 1 Month and not every 1 Week.
Problem 2
The contract never ends.
-
We create this contract with a Date End.
-
We add some products (in order to avoid the problem above).
As we can see, the Date End is not set on the lines. (origin of the error).
- We generate infinite invoices.
We are able to generate infinite invoices. Maybe the scheduled action controls this, but this should be controlled manually also.
Problem 3
Date end dissapear when changing the recurrency.
-
We create a contract. It must has a Date End. We save it.
-
We want to change de recurrency (it can happens). We notice the date end dissapears when we save the changes.
Problem 4
When having 2 or more lines, the last date invoice field doesn't compute correctly.
-
We create a contract. To see more clear the error, we set the recurrency every 1 week.
-
We create 1 invoice.
As we can see, the field last_date_invoice is mismatching between the 2 lines, when it should be the same because we aren't in a recurrency line level. If we had set a date end, we would be see an error at the last invoices, where only one product would be invoiced due to this error.
After exposing this, I made some several changes in the structure of the module contract.
Problem 5
If we put a Date End and we change the Date Of Next Invoice manually, the date end dissapears
-
We create a contract with Date End
-
We manually change the Date Of Next Invoice and we save it.
As you can see, the Date End dissapears.
Problem 6
We can't change the Date of Next Invoice in recurrence at line level
-
We create a contrat with recurrence at line level
-
We create a line. We only establish a product and we save.
-
We edit the line and we stablish the 'Date of Next Invoice' on day later. We save and close. The Next Period End is correctly changed.
-
We open the line again.
As we can see, the Date of Next Invoice is not changed making the next period end beig bad calculated.
Recently i was affected by problem 4, this PR solve it. I think this PR should be merged, it fix a lot of errors. what is happening with runbot building?
I ran into similar problems and this PR fixes them. LGTM