Commit Graph

32 Commits

Author SHA1 Message Date
Pedro M. Baeza
73872800c3 [IMP] account_payment_order: Mark invoices in a payment order as in payment
Odoo core already includes a mechanism, only activated in enterprise,
to mark invoices reconciled against a payment as "In payment", not as
"Paid", and then when the bank reconciliation is done, passed to "Paid".

As we already refactored the payment order transfer entries generation
to be done by payments, the only missing bits is to override the method
that returns the payment state to put.

We have limited this new payment state though to those invoices that
are part of a payment order, not all including those which were paid
pressing the button "Register payment", as that's out of the scope
of this module.

TT49386
2024-05-28 14:08:02 +02:00
Alejandro Ji Cheung
bff6d34936 [IMP] account_payment_order: adds restriction for duplicated move lines in payment order 2024-04-24 08:56:00 +02:00
Luc De Meyer
73d857295f [IMP] integrate transfer journal option into account_payment_order 2024-04-14 19:52:49 +02:00
Víctor Martínez
ef05873365 [IMP] account_payment_order: Display a message with the archived bank accounts
TT47789
2024-03-01 17:36:52 +01:00
Víctor Martínez
f2b050b093 [FIX] account_payment_order: Always return a string in the _get_payment_order_order_communication_direct() method.
Related to: https://github.com/OCA/bank-payment/issues/1178
2023-11-27 09:21:04 +01:00
Víctor Martínez
0757fe89ab [FIX] account_payment_order: Define the value of the communication field correctly
- Purchases: Ref field from invoice always.
- Sales: Payment_ref or ref field from invoice.

TT45153
2023-10-03 13:51:31 +02:00
Víctor Martínez
bd445ec935 [IMP] account_payment_order: Add a custom message if the invoice does not have a payment method
The message will be displayed when trying to create a line of a payment order to better clarify the reason.

TT44551
2023-07-24 15:57:54 +02:00
Wolfgang Pichler
0c98de15fa [MIG] account_payment_order: Migration to 16.0 2023-03-04 20:54:01 +01:00
Pedro M. Baeza
0466d31c3e [FIX] account_payment_order: Do correctly the fix on tests
Previous patch by Alexis created a co-dependency between
account_payment_order and account_banking_sepa_direct_debit, which is
not correct.

This patch avoids such problem and fix properly the test, although
the utility of some of them is debatible.
2023-03-04 19:44:00 +01:00
Pedro M. Baeza
05c6c0111f [REF+IMP] account_payment_order: Use native payments
The previous approach creates manually the journal entries and does all
the hard work, plus not being 100% compatible with the bank statement
reconciliation widget (requiring a patch on OCB to see blue lines).

That decision made sense on the moment it was done (v9), where the
native payment model (account.payment) was very limited, and wasn't able
to store all the needed information for the bank transaction.

Now that the limitations are gone, we can get rid off this extra model,
and generate instead `account.payment` records, using both the native
model + methods to perform the same operations.

This serves also to workaround the problem found in #966.

All the code, views and tests of main module have been adapted to this
new approach in this commit. Later commits will adapt the rest of the
modules of the suite, and add migration scripts to transit from the
previous approach to this new one.

TT39832
2023-03-04 19:44:00 +01:00
Denis Roussel
f3eca92554 [IMP] account_payment_order: Better communication field management
- Add a hook method to retrieve communication type and communication
- Improve normal communication if there is a credit note
  If there is a credit note that partially cancel an invoice, the payment communication
  should be the combination of the invoice reference and the credit note one.
- Remove not needed assert as parameter is required
- Use the 'payment_reference' field if filled in
- Add existing payment references to communication
  If some movements have been reconciled with the original invoice,
  their references should be added in communication too.
  e.g.: Manual credit notes
- Don't duplicate communication reference
2023-03-04 19:44:00 +01:00
Pedro M. Baeza
6a2621694b [FIX] account_payment_order: Proper indentation for test + make it work
The test introduced in 7bdb286aa1 is not
valid, as its indentation made it to not be executed. Anyways, the
content and the tested things are also not correct.
2023-03-04 19:44:00 +01:00
Carlos Lopez
ab739d0e62 [IMP] account_payment_order: outbound inheritable + SavepointCase
This commit split the tests for outbound payment in a base inheritable class that
can be reused in other dependant modules, and the test of this module.

similar to 86bd1a2525
2023-03-04 19:44:00 +01:00
David Ramia
72554d709a [FIX] account_payment_order: Fix tests
Some tests need to be run on post-install
The bank_journal.inbound_payment_order_only field is true only if all inbound_payment_method_ids are payment_order_only True. For this we must include the "SEPA Direct Debit for customers" in test
2023-03-04 19:44:00 +01:00
Pedro M. Baeza
617ccccac8 [FIX] account_payment_order: Don't fail due to tz
When the test hour is around midnight, and demo data using CET/CEST
timezones, current code fails due to some asserts not having this into
consideration. This fix avoids such problem, and irons the execution
no matter the hour.
2023-03-04 19:44:00 +01:00
Marçal Isern
ad9f376b29 [MIG] account_payment_order: Migration to 15.0 2023-03-04 19:44:00 +01:00
Alexis de Lattre
dc8dd37f0e [IMP] account_payment_order: computation of sepa + remove done state + UI adjustments
- Improve computation of sepa on account.payment.order: check IBAN is in SEPA zone
  Update move line generation to get transfer account from bank journal
  Update payment mode configuration accordingly (3 fields removed)
  Several improvements in payment order tree and form view
- Remove done state (migration script provided)
- Don't set reference_type field on account.move required=True, because it
  causes a lot of problems in other modules that don't depend on this one.
  Setting it as required in the view is enough.
- add optional="hide" on payment mode in invoice tree view
- FIX crash when communication=null on payment line
- payment_mode_id readonly when state != draft
2023-03-04 19:44:00 +01:00
João Marques
c7239bbc22 [FIX] account_payment_order: Fix multi-company issues in tests
Use base `account` tests from Odoo to avoid issues with the environment.
2023-03-04 19:44:00 +01:00
manu
d49f95cb95 [IMP]account_payment_order: payment date when adding transaction line 2023-03-04 19:43:51 +01:00
Benoit Aimont
3c11cf2aab [13.0][IMP] account_payment_order - move date should be bank line date when offsetting_account is bank_account 2023-03-04 19:42:52 +01:00
João Marques
e2401a13a3 [FIX] account_payment_order: Fix tests
After fcaa54939e, we need to specify the invoice date for vendor bills to be able to post it
2023-03-04 19:42:52 +01:00
João Marques
735fcfbee4 [FIX] account_payment_order: Fix tests
On multi-company settings, we need to make sure we are searching and creating objects with the correct company associated.

TT28423
2023-03-04 19:42:47 +01:00
Jesús Alan Ramos Rodríguez
c65a93af5b [MIG] account_payment_order: Migration to 14.0 2023-03-04 19:42:47 +01:00
Raf Ven
6cbf2bd82d [MIG] account_payment_order: Migration to 13.0 2023-03-04 19:39:08 +01:00
Raf Ven
284fe5c01c [IMP] account_payment_order: black, isort 2023-03-04 19:39:08 +01:00
Pedro M. Baeza
f53d7176f4 [FIX+IMP] account_payment_order: Make tests resilient + inbound inheritable + SavepointCase
Previous tests did several risk operations on tests, like performing an unbound search
on payment orders, what can lead to errors if there are some data on DB (or for example
we add in the future some payment orders in demo.

This commit also split the tests for inbound payment in a base inheritable class that
can be reused in other dependant modules, and the test of this module.

Finally, we use SavepointCase for improving performance in tests.
2023-03-04 19:39:08 +01:00
Raf Ven
29a705d71c [12.0] [FIX] Failing test test_account_payment_02 2023-03-04 19:39:08 +01:00
Thomas Binsfeld
e2f51e7d00 [REF+IMP] account_payment_order: invoice addition + move generation + restrict payment modes selection on orders
- allow add to order from invoice if order exists
- payment line creation from move line
  Benefits of the batch creation of Odoo 12.0
  The method returns the created payment lines
- split generate_move method
- only payment order option on payment methods
  New option on payment methods: payment order only (unchecked by default) allowing to enforce the use of payment orders for some payment methods
2023-03-04 19:37:36 +01:00
Jordi Ballester
a16d23c0ee When the user looks for open payables or receivables, in the
context of payment orders, she should ocus on the amount that
is due to be paid. In this method we are forcing to display both
the amount due in company and in the invoice currency.

We then hide the fields debit and credit, because they add no value.
2023-03-04 11:17:14 +01:00
etobella
2443cf0036 [MIG] account_payment_order 2023-03-04 11:16:04 +01:00
Pedro M. Baeza
d8e55d0ca2 [FIX] account_payment_order: Adapt test to v10 2023-03-04 11:16:04 +01:00
Akim Juillerat
ed069a89fa [IMP] account_payment_order: Restriction + tests
* Restrict the deletion of bank payment line
* Add test_cancel_payment_order
2023-03-04 11:16:04 +01:00