[IMP] website_portal_sale: better logging on mismatch
On transaction mismatch (amount coming back from acquirer does not match SO amount), currently: * the amounts in question are not logged, only that they do not match * the user is not notified and may not be aware that there was a payment and an issue Improve the logging message and add a chatter message to improve that. OPW-782986
This commit is contained in:
committed by
Nicolas Martinelli
parent
fb093726d7
commit
8b80141a63
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
import logging
|
||||
from odoo import api, fields, models
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.tools import float_compare
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -80,4 +80,16 @@ class PaymentTransaction(models.Model):
|
||||
_logger.info('<%s> transaction pending/to confirm manually, sending quote email for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
|
||||
tx.sale_order_id.force_quotation_send()
|
||||
else:
|
||||
_logger.warning('<%s> transaction MISMATCH for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
|
||||
_logger.warning(
|
||||
'<%s> transaction AMOUNT MISMATCH for order %s (ID %s): expected %r, got %r',
|
||||
acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id,
|
||||
tx.sale_order_id.amount_total, tx.amount,
|
||||
)
|
||||
tx.sale_order_id.message_post(
|
||||
subject=_("Amount Mismatch (%s)") % acquirer_name,
|
||||
body=_("The sale order was not confirmed despite response from the acquirer (%s): SO amount is %r but acquirer replied with %r.") % (
|
||||
acquirer_name,
|
||||
tx.sale_order_id.amount_total,
|
||||
tx.amount,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user