Friday, November 22, 2024
1 change
Resolved issues and error corrections
This fixes errors that prevented portal customers from paying overdue invoices, especially when paying multiple invoices together. It also ensures the correct payment amount is used so payments are not accidentally created for zero value.
Original PR description
Currently, multiple tracebacks are occurring when the portal user tries to pay the overdue amount. **To reproduce this issue:** 1) In accounting create multiple invoices with the customer as a portal…
Currently, multiple tracebacks are occurring when the portal user tries to pay the overdue amount. **To reproduce this issue:** 1) In accounting create multiple invoices with the customer as a portal user 2) Make sure to give the due date as past date while creating the invoices 3) Now login with portal user and try to pay the due amount in the batch **Error:-** ``` PaymentPortal.overdue_invoices_transaction() missing 1 required positional argument: 'payment_reference' ``` This error occurs because we didn't provide the `payment_reference` in `_prepareTransactionRouteParams`. when executing the `overdue_invoices_transaction()` transaction route. We can resolve this issue by providing the required arguments in the ` _prepareTransactionRouteParams() ` by overriding it in the account payment **Note:-** After resolving the above bug, we are encountering two more bugs. **Bug 1:-** When making a batch payment, we are getting an ensure_one() error if the due amount spans multiple invoices. This occurs from the following line: https://github.com/odoo/odoo/blob/65811ebaf309c462bf918b01d4401695d87b44d6/addons/account_payment/models/payment_transaction.py#L172-L173 **Bug 2:-** After resolving Bug 1, when we try to make a payment, the amount appears as 0.0 This is because we are passing the amount value in a dictionary with the key as `payment`. while rendering the `portal_overdue_invoices_page`. https://github.com/odoo/odoo/blob/65811ebaf309c462bf918b01d4401695d87b44d6/addons/account_payment/controllers/portal.py#L63 https://github.com/odoo/odoo/blob/65811ebaf309c462bf918b01d4401695d87b44d6/addons/account_payment/controllers/portal.py#L86-L90 While rendering the `payment.form` template from `portal_overdue_invoices_page`, the amount value is missing in `this.paymentContext`, resulting in the amount being null. https://github.com/odoo/odoo/blob/65811ebaf309c462bf918b01d4401695d87b44d6/addons/payment/static/src/js/payment_form.js#L414-L415 This leads to a successful payment with the amount as 0.0. sentry-5741581459