Commit Graph

57 Commits

Author SHA1 Message Date
Pedro M. Baeza
fcb2093e63 [FIX] account_payment_order: Set payment method line for account.payment
On v15+, a new model account.payment.method.line is introduced for
fine-graining the outstanding account, being `payment_method_id` a
related field referred to this new model, so we need to change the
previous approach to select the proper method line only if found. If not
found, it will be auto-selected by standard code.

TT43278
2023-05-12 19:46:09 +02:00
Simon Gonzalez
b4a46bebef [IMP] account_payment_order: Concatenate all UserError messages
Gather all the errors to only show one with all the problem on the current debit order. This will avoid for the users to have to make multiple time the same process.
2023-04-18 08:32:39 +02:00
Reyes4711
594a3e4fa6 [FIX] account_payment_order: create lines with same sequence name 2023-04-06 12:53:43 +02:00
Wolfgang Pichler
0c98de15fa [MIG] account_payment_order: Migration to 16.0 2023-03-04 20:54:01 +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
Alexis de Lattre
6eb7ad01e3 [IMP] account_payment_order: add link to payment order in chatter 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
Antony Herrera
610cd5e4f7 [FIX] account_payment_order: Error in Batch Payments when deleting a Batch Content line 2023-03-04 19:44:00 +01:00
manu
8dd5a31124 [IMP]account_payment_order: Add activities to account.payment.order model 2023-03-04 19:44:00 +01:00
Adrien Peiffer
38c56c5c61 [FIX] Restore payment order number in account move line label. 2023-03-04 19:44:00 +01:00
Alexis de Lattre
b0b48a204d [FIX] account_payment_order: fix action returned by create_account_payment_line()
create_account_payment_line() is supposed to returned a form view for a
single payment order and a tree view for multiple payment orders. Before
this fix, it would return a tree view if you were payment more than 1
invoices while generating a single payment order, because the list
result_payorder_ids would contain several time the same ID.
2023-03-04 19:44:00 +01:00
Miquel Raïch
62ca0b90f8 [IMP] account_payment_order: don't requiere reference_type anymore 2023-03-04 19:44:00 +01:00
Alexis de Lattre
7e7ebe1c75 account_payment_order: communication required in form view 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
AmmarOfficewalaSerpentCS
a597822f2c [IMP] account_payment_order: Add hook method for finding previous payment orders + Pass single move in a get_account_payment_domain mehtod to find move in a method. 2023-03-04 19:43:51 +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
Pedro M. Baeza
320be4a4c7 [FIX] account_payment_order: Computed non-stored fields needs always a value
We should assign a value for all records of the set.
2023-03-04 19:42:52 +01:00
Carlos Roca
16274598ac [MIG] account_payment_order: Migration to v14 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
Andrea
28a35012b0 [FIX] avoid cache miss in compute 2023-03-04 19:42:47 +01:00
Valentin Vinagre Urteaga
0c571a2028 [FIX] account_payment_order: set partner_bank_id + order generation from invoice tree + attachment file name
- fix set partner_bank_id in account move lines
  Case: The bank account isn't set properly in the payment order lines, because the bank account is only got from account.move.line or the first bank account in the partner_id, but never from the invoice (account.move).
  Solution: With this fix, the bank account will be get from account.move when matching the criteria.
-  fix payment orders from invoice tree view
  Case: User can't add invoices to payment/debit orders from the tree view but it's still possible to add them one by one from the form view.
  Solution: Remove binding_views="form": by default are "tree & form". With this fix, users can add payment/debit orders from the invoice tree view
- fix the attachment file name & dowload.
  Case: After the configuration of a debit order and generating the .xml file, user can't download it from the next step screen using the download link.
  Solution: This fix makes the .xml file downloadable from the .xml file name as it was in older versions
2023-03-04 19:41:03 +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
Carlos Dauden
70505b8128 [IMP] account_payment_order: Select first partner bank 2023-03-04 19:39:08 +01:00
Pedro M. Baeza
d68dd84c19 [FIX] account_payment_error: Avoid singleton error in allowed_journal_ids
Fixes #612
2023-03-04 19:39:08 +01:00
Guewen Baconnier
01ac03b93e Add indexes on account payment models
The fields where the indexes are added are used in searches in
account_payment_order, which becomes really slow when a database have
many lines.
2023-03-04 19:39:08 +01:00
Thomas Binsfeld
c9b07b7533 [REF] Payment Order: move all move preparation code in _prepare_move 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
Pedro M. Baeza
794cba3373 [FIX] account_payment_order: Fix journal domain
Steps to reproduce
------------------

* Create a payment mode with "Link to Bank Account" = "Variable".
* Select several journals.
* Create a payment order with that payment mode.
* Save.
* Go to other menu and come back to payment order.
* Try to select a journal: the list is empty.

Fixes #544
2023-03-04 11:17:15 +01:00
Thomas Binsfeld
1be0b508f7 [REF] Payment Order: better performance of draft2open method
Add a norecompute in draft2open to avoid the recomputation of total_company_currency n times (where n is the number of payment lines)
2023-03-04 11:17:15 +01:00
Pedro M. Baeza
eb9a0f2cc5 [MIG] account_banking_sepa_direct_debit: Finish migration to 12.0
* Fixed tests
* Adjust code for Python dates handling
* Update copyrights
2023-03-04 11:17:14 +01:00
Pedro M. Baeza
297b91ec86 [MIG] account_payment_order: Finish migration to v12
* Removed deprecated YAML tests.
* Removed document dependency, as now there's no attachment dropdown.
* Switched deprecated `compute` method of res.currency.
* Restored missing field `reference_type` in invoices.
* Fixed call to `message_post`.
* Added missing description in model.
2023-03-04 11:17:14 +01:00
Martronic SA
00b52fcd86 Fix structured communication
Adds 'structured' to the invoice_reference_type2communication_type ans the 'structured' type is added by the module itself in account_invoice but breaks the account_move_line.py as explained here: https://github.com/OCA/bank-payment/issues/495
2023-03-04 11:17:14 +01:00
ecino
cba78716d7 [IMP] account_payment_order: Use bank.payment.line reference in Payment Order Move Lines (#418) 2023-03-04 11:17:14 +01:00
Alexis de Lattre
15fafb32e3 Several small usability improvements
- 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.
2023-03-04 11:17:14 +01:00
Pedro M. Baeza
2608ce18de [FIX] account_payment_order: Take payment mode from move (#466)
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.
2023-03-04 11:17:14 +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
Gilles Meyomesse (ACSONE)
0bb431baac [ADD] report for payment order (#370) 2023-03-04 11:16:04 +01:00
gilles
a66448cc2c [ADD] description field for payment order 2023-03-04 11:16:04 +01:00
Akim Juillerat
470c296b16 [10.0]Fix payment method onchange with multicompany (#374) 2023-03-04 11:16:04 +01:00
Adrien Peiffer (ACSONE)
2e32e672d1 [IMP] account_payment_order: select partner bank account automatically. 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
mdietrichc2c
8826481a25 [IMP] account_payment_order: Don't allow deletion of an uploaded payment order + allow to cancel an uploaded payment order 2023-03-04 11:16:04 +01:00
Alexis de Lattre
213c257b00 [FIX+IMP] account_payment_order:
* FIX: Bug #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.
2023-03-04 11:16:04 +01:00
vrenaville
fd68ec161e [FIX] fill date instead off maturity date on account move line generated 2023-03-04 11:16:04 +01:00
Jose Maria Alzaga
f3633ea4bf Remove internal_type=other restriction for transfer account (#311) 2023-03-04 11:16:03 +01:00
Adrien Peiffer (ACSONE)
99c21a5ed0 [FIX] account_payment_order: Use 'index' instead of 'select' 2023-03-04 11:16:03 +01:00