Submit payments and do reschedule invoices

Is missing a control to submit payments and after, do reschedule invoices?

Here I explain an example:

  1. Post an invoice

Invoice ID 54

  1. Financial / Payments. Create a payment. In line field, select the move line from move 26 and click the submit button.

Payment ID 5

  1. Go to invoice (ID 54) and “Reschedule Lines (Main Receivable)” wizard.

In this example, in the number field: 4

Reload the invoice ID 54:

  • Move: 26
  • Additional moves: 27
  1. Go the move 27 and click “post”

Move 27 (ID 37)

  1. Create new payment: In line field, you can select one move line from move 27 and click the submit button.

Payment ID 7

  1. At the moment, we have two payments that the total are 250 USD, but the invoice is 200 USD

Please do not use data from demo to explain your issue because such data will be remove in less than 24h.

I guess we could have some extra controls like:

  • check that move line of payment is not reconciled when submitted.
  • add a warning when reschedule a line with payments.

I like this proposal but I think it should be an error and not a warning if the payment is not failed.
In case the payment should be really rescheduled the user must fail the payment.

Well it is not always a possibility for the user.

Of course but if the user is not allowed to fail the payment it must ask somebody else to do it.
Otherwise, rescheduling the payment will produce a duplicated line to pay.

This is not necessary about permission.

Like in many other possible cases.

Then we need to prevent all of them.

I have a another similar case which may afect payments. Here is my scenario:

  1. Create a supplier invoice and post it
  2. Creat a payment for the supplier invoice, submit and approve it (but do not submit it)
  3. Cancel the invoice

Currently there is no warning nor any error raised to let the user know that the payment is on the way.
Also the payment is not updated so at the end it will result in paying a cancelled invoice.

Furthermore, in such state it is not possible to delete the payment, as you get a DomainValidationError complaining that the line should not be reconciled for draft state.

Here is a first step to prevent double payment: Draft: Prevent double payments (!779) · Merge requests · Tryton / Tryton · GitLab