From 03cd074ee84889ed6005647aae76cd0265c67b3b Mon Sep 17 00:00:00 2001 From: kcv-odoo Date: Thu, 28 Dec 2023 11:27:26 +0530 Subject: [PATCH] [IMP] payment_razorpay: authorize only when manual capture is enabled Before this commit razorpay provider handle both authorized and done event for transaction even though razorpay return both authorized and done event at same time and there is no need to handle authorize event if capture manual is disabled on razorpay and because if handling both events at same time it causing serialization issue and it might cause serious issue if other operation are being executed on same time. This commit handle authorized event only when capture manuallly option is enabled on razorpay so it will not try to write on operation at same time and avoid concurrency issues. task-3652228 closes odoo/odoo#147534 Signed-off-by: Antoine Vandevenne (anv) --- addons/payment_razorpay/models/payment_transaction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/payment_razorpay/models/payment_transaction.py b/addons/payment_razorpay/models/payment_transaction.py index 07c9da19a9c..e360ec2c171 100644 --- a/addons/payment_razorpay/models/payment_transaction.py +++ b/addons/payment_razorpay/models/payment_transaction.py @@ -394,7 +394,8 @@ class PaymentTransaction(models.Model): if entity_status in const.PAYMENT_STATUS_MAPPING['pending']: self._set_pending() elif entity_status in const.PAYMENT_STATUS_MAPPING['authorized']: - self._set_authorized() + if self.provider_id.capture_manually: + self._set_authorized() elif entity_status in const.PAYMENT_STATUS_MAPPING['done']: if self.tokenize: self._razorpay_tokenize_from_notification_data(notification_data)