[FIX] (account, sale)_payment: fix s2s on not existing document
Returned error was not correct as just browsing an ID that does not exist is not sufficient. We should use exists.
This commit is contained in:
@@ -64,7 +64,7 @@ class PaymentPortal(http.Controller):
|
||||
if access_token:
|
||||
params['access_token'] = access_token
|
||||
|
||||
invoice_sudo = request.env['account.invoice'].sudo().browse(invoice_id)
|
||||
invoice_sudo = request.env['account.invoice'].sudo().browse(invoice_id).exists()
|
||||
if not invoice_sudo:
|
||||
params['error'] = 'pay_invoice_invalid_doc'
|
||||
return request.redirect(_build_url_w_params(error_url, params))
|
||||
|
||||
@@ -64,7 +64,7 @@ class PaymentPortal(http.Controller):
|
||||
if access_token:
|
||||
params['access_token'] = access_token
|
||||
|
||||
order_sudo = request.env['sale.order'].sudo().browse(order_id)
|
||||
order_sudo = request.env['sale.order'].sudo().browse(order_id).exists()
|
||||
if not order_sudo:
|
||||
params['error'] = 'pay_sale_invalid_doc'
|
||||
return request.redirect(_build_url_w_params(error_url, params))
|
||||
|
||||
Reference in New Issue
Block a user