[IMP] account_payment, sale: log messages with superuser
When payment providers receive a notification from a webhooks and log something in the chatter of transactions, sale orders or invoices, the message is shown as from 'Public User'. Now, all messages will be logged as 'OdooBot'. Part-of: odoo/odoo#100186
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
|
||||
|
||||
class PaymentTransaction(models.Model):
|
||||
@@ -180,6 +180,7 @@ class PaymentTransaction(models.Model):
|
||||
:return: None
|
||||
"""
|
||||
self.ensure_one()
|
||||
self = self.with_user(SUPERUSER_ID) # Log messages as 'OdooBot'
|
||||
if self.source_transaction_id.payment_id:
|
||||
self.source_transaction_id.payment_id.message_post(body=message)
|
||||
for invoice in self.source_transaction_id.invoice_ids:
|
||||
|
||||
@@ -98,6 +98,7 @@ class PaymentTransaction(models.Model):
|
||||
:return: None
|
||||
"""
|
||||
super()._log_message_on_linked_documents(message)
|
||||
self = self.with_user(SUPERUSER_ID) # Log messages as 'OdooBot'
|
||||
for order in self.sale_order_ids:
|
||||
order.message_post(body=message)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user