Skip to content

Commit 079fc98

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#229194 X-original-commit: 8ce44b0 Related: odoo/enterprise#95857 Signed-off-by: Julien Alardot (jual) <[email protected]> Signed-off-by: Raj Bhuva (bhra) <[email protected]>
1 parent b787cfe commit 079fc98

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
@@ -392,7 +392,7 @@ def _compute_batches(self):
392392

393393
wizard.batches = batch_vals
394394

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

0 commit comments

Comments
 (0)