Skip to content

Commit 8ce44b0

Browse files
committed
[FIX] account: show warning when selecting trusted bank account
**Steps to reproduce:** 1. Install the modules: `accounting` and `account_iso20022`. 2. Configure a bank journal with SEPA credit transfer in *Outgoing payment methods*. 3. Create a partner with two bank accounts: one trusted, one untrusted. 4. Create a vendor bill for this partner. 5. Register a payment using the SEPA credit transfer method. 6. Manually select the trusted bank account from the dropdown. **Observed behavior:** * A warning banner is shown when the trusted account is selected. **Root cause:** * `_compute_trust_values` only validated the bank account from the batch (original invoice data) and ignored the `partner_bank_id` if the user changed it manually in the wizard. **Solution:** * Update `_compute_trust_values` to also validate the currently selected `partner_bank_id`, ensuring the trust check reflects the user’s actual selection. opw-5059740 closes odoo#227404 Related: odoo/enterprise#95124 Signed-off-by: Julien Alardot (jual) <[email protected]>
1 parent 0324848 commit 8ce44b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

addons/account/wizard/account_payment_register.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def _compute_batches(self):
393393

394394
wizard.batches = batch_vals
395395

396-
@api.depends('payment_method_line_id', 'line_ids', 'group_payment')
396+
@api.depends('payment_method_line_id', 'line_ids', 'group_payment', 'partner_bank_id')
397397
def _compute_trust_values(self):
398398
for wizard in self:
399399
total_payment_count = 0
@@ -405,7 +405,8 @@ def _compute_trust_values(self):
405405
for batch in wizard.batches:
406406
payment_count = 1 if wizard.group_payment else len(batch['lines'])
407407
total_payment_count += payment_count
408-
batch_account = wizard._get_batch_account(batch)
408+
# Use the currently selected partner_bank_id if in edit mode, otherwise use batch account
409+
batch_account = wizard.partner_bank_id or wizard._get_batch_account(batch)
409410
if wizard.require_partner_bank_account:
410411
if not batch_account:
411412
missing_account_partners += batch['lines'].partner_id

0 commit comments

Comments
 (0)