[16.0][IMP] account_payment_partner:Check first if payment method is sepa_direct_debit#1566
[16.0][IMP] account_payment_partner:Check first if payment method is sepa_direct_debit#1566ekainlarrea wants to merge 2 commits intoOCA:16.0from
Conversation
|
If you have set a partner bank in the invoice, that one should have preference. Remove it and configure the system to not fill it (uncheck "Bank account required" in the payment method) for having the desired result. |
|
But the partner_bank_id in the invoice specifies the bank account to which the invoice will be paid. This means when using sepa direct debit, the partner_bank_id will be one from the company not the one from the customer. |
|
The idea is to overpass all of this with: bank-payment/account_payment_partner/models/account_move.py Lines 98 to 125 in c667a24 and AFAIK, the domain is changed for customer invoices and payment mode. Am I wrong? |
|
I understand that, but isn't it a bit weird to overpass it? Even if you uncheck "Bank account required" in the payment mode, the user may be able to set partner_bank_id and change the bank account returned by the function partner_banks_to_show which is then only used (AFAIK) in the invoice report. |
|
OK, right, let's do one thing: please move that code to the |
227a2b3 to
9f6f7f8
Compare
marcos-mendez
left a comment
There was a problem hiding this comment.
Automated Review -- Tests Failed
1. Root Cause of Test Failure
The test failure occurs because the unidecode Python library is missing from the environment. This dependency is required by the account_banking_pain_base module, which is a dependency of account_banking_sepa_direct_debit. The error prevents Odoo from loading the module and initializing the database.
2. Suggested Fix
Install the missing unidecode Python package in the test environment:
pip install unidecodeThis should be done before running the tests to avoid the DistributionNotFound error.
3. Additional Code Issues
- No issue identified in the provided diff. The code change in
account_move.pycorrectly overrides thepartner_banks_to_showmethod to handle SEPA direct debit logic, and the removal of duplicated logic inaccount_payment_partneris correct. - The new
account_move.pyinaccount_banking_sepa_direct_debitis a valid extension and follows OCA patterns.
4. Test Improvements
To improve test coverage for the new logic in account_banking_sepa_direct_debit, consider adding the following test cases in a TransactionCase or SavepointCase:
Suggested Test Cases:
-
Test
partner_banks_to_showwith SEPA direct debit payment mode:- Create a move with
payment_mode_id.payment_method_id.code == "sepa_direct_debit" - Ensure it returns
mandate_id.partner_bank_idorpartner_id.valid_mandate_id.partner_bank_id - Assert that
super().partner_banks_to_show()is called for other payment methods.
- Create a move with
-
Test
partner_banks_to_showwith no mandate:- Create a move with SEPA direct debit but no valid mandate.
- Ensure it gracefully falls back to
super().partner_banks_to_show()or returns empty recordset.
-
Test
partner_banks_to_showwith valid mandate:- Create a move with a valid mandate and ensure the correct bank is returned.
OCA Testing Pattern:
Use TransactionCase for tests that require database changes (e.g., creating mandates, payment modes, etc.). Tag tests appropriately using @tagged('post_install', 'manual') if they are not part of the automatic test suite.
Example:
from odoo.tests import TransactionCase
from odoo.tests.common import tagged
@tagged('post_install', 'manual')
class TestPartnerBanksToShow(TransactionCase):
def test_partner_banks_to_show_sepa_direct_debit(self):
# Test logic here
passThis ensures that the new logic is fully tested under realistic conditions.
Reciprocal Review Request
Hi everyone! I found some test failures on this PR and left detailed feedback above. I am happy to discuss or help debug. In the meantime, if any of you get a chance, I would appreciate a look at my open PR(s):
My open PRs across OCA:
- hr-attendance#262 [16.0][ADD] Hr_attendance_idsecure: iDSecure (ControliD) attendance integration
- stock-logistics-workflow#2276 [16.0][ADD] stock_move_line_devaluation
- stock-logistics-workflow#2275 [16.0][ADD] Stock move line analytic account
- stock-logistics-workflow#2268 [16.0][ADD] stock_move_line_picking_partner
- purchase-workflow#2694 [16.0][IMP]Purchase workflow added to review state & exception fix
Reviewing each other's work helps the whole community move forward. Thank you!
Environment via OCA Neural Reviewer: Minikube + K8s Job + oca-ci/py3.10-odoo16.0 | Odoo 16.0
Automated review by OCA Neural Reviewer + qwen3-coder:30b
…irect_debit
When partner_bank_id is set will be printed even if payment mode is sepa_direct_debit not showing clients bank account.
This PR fixes it.