contract icon indicating copy to clipboard operation
contract copied to clipboard

[16.0][IMP] contract: Big changes in recurrency fields

Open flalexg opened this issue 1 year ago • 13 comments

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.

  1. We add a product. image

  2. We change the recurrency image

  3. We save and we create 3 invoices image

As we can see, the recurrence is every 1 Month and not every 1 Week.

Problem 2

The contract never ends.

  1. We create this contract with a Date End. image

  2. We add some products (in order to avoid the problem above). image

As we can see, the Date End is not set on the lines. (origin of the error).

  1. We generate infinite invoices.

image

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.

  1. We create a contract. It must has a Date End. We save it. image

  2. We want to change de recurrency (it can happens). We notice the date end dissapears when we save the changes. image

Problem 4

When having 2 or more lines, the last date invoice field doesn't compute correctly.

  1. We create a contract. To see more clear the error, we set the recurrency every 1 week. image

  2. We create 1 invoice.

image

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

  1. We create a contract with Date End image

  2. We manually change the Date Of Next Invoice and we save it.

image

As you can see, the Date End dissapears.

Problem 6

We can't change the Date of Next Invoice in recurrence at line level

  1. We create a contrat with recurrence at line level image

  2. We create a line. We only establish a product and we save. image

  3. 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. image

  4. We open the line again. image

As we can see, the Date of Next Invoice is not changed making the next period end beig bad calculated.

flalexg avatar Apr 24 '24 15:04 flalexg

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?

javierjcf avatar Jun 12 '24 15:06 javierjcf

I ran into similar problems and this PR fixes them. LGTM

ChristophAbenthungCibex avatar Jul 29 '24 11:07 ChristophAbenthungCibex