[FIX] payment: do not display postgres operational errors
- When processing payments on the payments processing page, `psycopg2.OperationalError` can be raised. We do not want those exceptions to be displayed to the customers, instead we want the polling page to try to process the payments again. This commit hides the display of psycopg2 operational errors. - This commit also fixes the "processing your payments" message being hidden after the first polling, no matter if the processing has succeeded or not. closes odoo/odoo#33462 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import logging
|
||||
import psycopg2
|
||||
|
||||
from odoo import http, _
|
||||
from odoo.http import request
|
||||
@@ -93,6 +94,10 @@ class PaymentProcessing(http.Controller):
|
||||
tx_to_process = payment_transaction_ids.filtered(lambda x: x.state == 'done' and x.is_processed is False)
|
||||
try:
|
||||
tx_to_process._post_process_after_done()
|
||||
except psycopg2.OperationalError as e:
|
||||
request.env.cr.rollback()
|
||||
result['success'] = False
|
||||
result['error'] = "tx_process_retry"
|
||||
except Exception as e:
|
||||
request.env.cr.rollback()
|
||||
result['success'] = False
|
||||
|
||||
@@ -54,6 +54,8 @@ odoo.define('payment.processing', function (require) {
|
||||
}
|
||||
else {
|
||||
switch(data.error) {
|
||||
case "tx_process_retry":
|
||||
break;
|
||||
case "no_tx_found":
|
||||
self.displayContent("payment.no_tx_found", {});
|
||||
break;
|
||||
@@ -63,11 +65,7 @@ odoo.define('payment.processing', function (require) {
|
||||
}
|
||||
}
|
||||
self.startPolling();
|
||||
}).always(function(){
|
||||
if ($.blockUI) {
|
||||
$.unblockUI();
|
||||
}
|
||||
}).fail(function(e) {
|
||||
}).fail(function(e) {
|
||||
self.displayContent("payment.rpc_error", {});
|
||||
self.startPolling();
|
||||
});
|
||||
@@ -117,6 +115,7 @@ odoo.define('payment.processing', function (require) {
|
||||
},
|
||||
displayContent: function (xmlid, render_values) {
|
||||
var html = Qweb.render(xmlid, render_values);
|
||||
$.unblockUI();
|
||||
this.$el.find('.o_payment_processing_content').html(html);
|
||||
},
|
||||
displayLoading: function () {
|
||||
|
||||
Reference in New Issue
Block a user