Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] account_payment_order: Migration to 16.0 #1056

Merged
merged 112 commits into from
Mar 4, 2023

Conversation

pedrobaeza
Copy link
Member

Commit history redone from scratch + squash administrative commits + bring and squash changes for 16.0 from #972 for finishing the migration.

@Tecnativa

alexis-via and others added 30 commits March 4, 2023 11:09
…the Sorrento Code sprint 2016

Improvements include:
- full re-organisation of modules and big re-organisation of the code
- simplification of the code related to the fact that support for direct debit is now in t
he base module, not added by an optional module account_direct_debit (module was removed)
- new design of the wizard to select move lines to pay
- support for non-SEPA file transfer-
- support for German direct debit SEPA files (fixes bug OCA#129)
- remove workflow of payment.order
- add wizard of selection of move lines to pay
* IMP: prevent deleting a move-line that is linked to a payment order line
* FIX: better filtering of move lines already included in open payment order
Take into account all the remaining remarks of Frederic Clementi dated May 30:
- see multi-currency amounts in the wizard to add transaction lines
- add help msg on bank payment lines
* IMP: extensibility of _prepare_move

  Pass the list of bank lines to _prepare_move so it is possible to customize the move (eg it's name) based on the lines being paid.

* FIX: payment order: add missing onchange dependencies in move selection wizard
* Fix crash when selecting a customer that has a direct debit payment mode but no mandate
* Hide many fields when payment_order_ok is False on a payment_mode
* Fix payment line communication when the move line is not linked to an invoice (problem found when porting donation_debit_debit to v9)
* For the communication field, if self.move_id.ref is False, fallback on self.move_id.name
Port almost all modules to v10

* Update to EPC Rulebook v9.2 that start to apply on 2016-11-20 (bug OCA#300)
* FIX: Bug OCA#353 crash when selecting a payment mode that has a variable link to a bank account
* FIX: Add 'post_move' option on account.payment.mode with default True, to keep the previous behavior
* IMP: Explicit error when bank account is missing on bank journal
* IMP: Add field default_date_prefered on payment mode.
…ent order + allow to cancel an uploaded payment order
* Restrict the deletion of bank payment line
* Add test_cancel_payment_order
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.
When adding to a payment order from invoices, the payment mode
considered is the one in the invoice, but once you have confirmed it,
you can't change it, so if you change the payment mode in the journal
items, it doesn't make the difference.

With this change, this is taken into account for adding to the
payment order(s) properly.
- when manually encoding a payment line, get company currency as default currency
- Search on payment order numbers
- Direct search on bank journal name in payment orders
- remove widget="selection" on account.payement.mode : this object is rarely modified, so widget='selection' is not a time saver, but we miss the HTML link, which can be pretty convenient to check the configuration.
antony-psc and others added 9 commits March 4, 2023 19:44
Add partner_bank_id column to avoid MemoryError on an existing Odoo
instance with lots of data.

partner_bank_id on account.move.line requires payment_order_ok to be True
which it won't be as it's newly introduced - again nothing to compute.
(see AccountMoveLine._compute_partner_bank_id() in models/account_move_line.py)
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 OCA@86bd1a2
The test introduced in 7bdb286 is not
valid, as its indentation made it to not be executed. Anyways, the
content and the tested things are also not correct.
- 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
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 OCA#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
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.
@pedrobaeza
Copy link
Member Author

/ocabot migration account_payment_order

@pedrobaeza pedrobaeza force-pushed the 16.0-mig-account_payment_order branch from 75d696d to 0c98de1 Compare March 4, 2023 19:54
@pedrobaeza
Copy link
Member Author

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-1056-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit f3683bb into OCA:16.0 Mar 4, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 2fabbf9. Thanks a lot for contributing to OCA. ❤️

@acsonefho
Copy link
Contributor

@pedrobaeza Did you miss the migration folder? Or did you remove it yourself? Any particular reason?

@pedrobaeza pedrobaeza deleted the 16.0-mig-account_payment_order branch April 21, 2023 06:54
@pedrobaeza
Copy link
Member Author

There are no migration scripts. They all happened in previous versions, not for this one.

@acsonefho
Copy link
Contributor

@pedrobaeza
Copy link
Member Author

And they are incorrect. As said, they belong to older versions, where the refactoring to native payment happened. You reach this version with that refactoring done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.