OCA / l10n-portugal

Odoo Portuguese localization
GNU Affero General Public License v3.0
4 stars 27 forks source link

16.0 fix down payment #95

Closed cpintofonseca closed 4 months ago

cpintofonseca commented 1 year ago

The goal of this PR is to allow to deduct down payments on an invoice using InvoiceXpress.

First problem:

  1. Create an invoice with a down payment;
  2. Create a second invoice and deduct down payments. Odoo will create a negative line with the down payments on the second invoice. We can't have negative lines in InvoiceXpress.

Second problem: We can't register a payment on a credit note. When we finalize a credit note in InvoiceXpress (the equivalent of posting a credit note in Odoo) it automatically changes the state to paid.

Solution to first problem: When we post an invoice, we will look for down payments with negative amounts. Before the post, we will delete those negative lines from the invoice and delete the down payment section. After the post we will create, post and reconcile a new credit note linked with the invoice, using the deleted lines.

Solution to second problem: We will prevent in Odoo the registration of a payment in the credit note, forcing a reconciliation in the source invoice instead. We will also prevent the registration of a payment in the source invoice, if the source invoice has outstanding credits.

OCA-git-bot commented 1 year ago

Hi @dreispt, some modules you are maintaining are being modified, check this out!

dreispt commented 1 year ago

I believe this is a workflow need, and not a InvX connector need. When creating the invoice, a separate Credit Note document should be also created for the down payment. Both document will eventually need to be sent to InvX, but no change in the connector will be needed for that.

dreispt commented 9 months ago

See #104 for a proof of concept of what I think the the right solution.

github-actions[bot] commented 5 months ago

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.