odoo/odoo#203027

Created by fw-bot
Closed
label
odoo-dev:saas-18.1-17.0-sepa_missing_partner_bank-thbe-424872-fw
head
d08d03cc1c6456ec99b1637bfafe2e761309e322
odoo/odoo
17.0 #201608
saas-17.4 #203003
18.0 #203022
saas-18.1 #203027
saas-18.2 #203030
master #203031

[FW][FIX] account: SEPA payment missing partner_bank_id value

Description of the issue this commit addresses:

When registering a SEPA payment, it is possible to get a UserError telling you
to validate therecipient bank account while it is validated.


Steps to reproduce:

  1. Install account.
  2. Activate SEPA Credit Transfer (SCT) in the settings.
  3. On the Bank journal's settings, input an account number.
  4. Make sure the accounts used for the transfer authorize sending money.
  5. Create a move in the misc journal with multiple lines and distinct partners.
  6. Post the move. Go in the journal entries. Select it. "Register Payment".
  7. Change the Payment Method for SEPA Credit Transfer. "Create Payments".
  8. A UserError shows up.

Desired behavior after this commit is merged:

No UserError shows up, the payments are created.


Note on the fix:

The error happened because one of the condition for raising the UserError is a
value of a record in a many2one relation which is a stored computed field. As
the payment is created with a list of values, the compute method is not
triggered and the many2one remains empty while it should not.

This fix makes sure the partner_bank_id is only put in the payment values once
it has been computed to avoid keeping it false.


opw-4518374


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #203003
Forward-Port-Of: #201608