[FIX] payment: enhance log message for payment requests

Before this commit, the log message did not clearly indicate
who attempted to request a payment.

After this commit, the message specifies whether the payment request
was initiated by the customer or by the system.

task-3864521

closes odoo/odoo#161252

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
kpt-odoo
2024-04-22 11:51:22 +00:00
parent cf0743a679
commit a1c7a6a838
2 changed files with 6 additions and 6 deletions
@@ -196,15 +196,15 @@ class PaymentTransaction(models.Model):
:return: None
"""
self.ensure_one()
self = self.with_user(SUPERUSER_ID) # Log messages as 'OdooBot'
author = self.env.user.partner_id if self.env.uid == SUPERUSER_ID else self.partner_id
if self.source_transaction_id:
for invoice in self.source_transaction_id.invoice_ids:
invoice.message_post(body=message)
invoice.message_post(body=message, author_id=author.id)
payment_id = self.source_transaction_id.payment_id
if payment_id:
payment_id.message_post(body=message)
payment_id.message_post(body=message, author_id=author.id)
for invoice in self.invoice_ids:
invoice.message_post(body=message)
invoice.message_post(body=message, author_id=author.id)
#=== BUSINESS METHODS - POST-PROCESSING ===#
+2 -2
View File
@@ -106,9 +106,9 @@ class PaymentTransaction(models.Model):
:return: None
"""
super()._log_message_on_linked_documents(message)
self = self.with_user(SUPERUSER_ID) # Log messages as 'OdooBot'
author = self.env.user.partner_id if self.env.uid == SUPERUSER_ID else self.partner_id
for order in self.sale_order_ids or self.source_transaction_id.sale_order_ids:
order.message_post(body=message)
order.message_post(body=message, author_id=author.id)
def _reconcile_after_done(self):
""" Override of payment to automatically confirm quotations and generate invoices. """