use Markup instead of body_is_html=True
This commit is contained in:
parent
bead0deecd
commit
48aae5aa69
1 changed files with 14 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
|
from markupsafe import Markup
|
||||||
|
|
||||||
|
|
||||||
class SaleOrderDuplicationWizard(models.TransientModel):
|
class SaleOrderDuplicationWizard(models.TransientModel):
|
||||||
|
|
@ -64,12 +65,21 @@ class SaleOrderDuplicationWizard(models.TransientModel):
|
||||||
now = fields.Datetime.now()
|
now = fields.Datetime.now()
|
||||||
|
|
||||||
# Message pour la commande originale
|
# Message pour la commande originale
|
||||||
original_msg_body = f"A new quotation <a href='#' data-oe-model='sale.order' data-oe-id='{new_order.id}'>#{new_order.name}</a> created by {user_name} duplicating this Quotation."
|
original_msg_body = Markup(
|
||||||
self.original_order_id.message_post(body=original_msg_body, body_is_html=True)
|
f"A new quotation <a href='#' data-oe-model='sale.order' "
|
||||||
|
f"data-oe-id='{new_order.id}'>#{new_order.name}</a> "
|
||||||
|
f"created by {user_name} duplicating this Quotation."
|
||||||
|
)
|
||||||
|
self.original_order_id.message_post(body=original_msg_body)
|
||||||
|
|
||||||
# Message pour la nouvelle commande dupliquée
|
# Message pour la nouvelle commande dupliquée
|
||||||
new_msg_body = f"This quotation has been created by {user_name} duplicating the original Quotation <a href='#' data-oe-model='sale.order' data-oe-id='{self.original_order_id.id}'>#{self.original_order_id.name}</a>."
|
new_msg_body = Markup(
|
||||||
new_order.message_post(body=new_msg_body, body_is_html=True)
|
f"This quotation has been created by {user_name} duplicating the original "
|
||||||
|
f"Quotation <a href='#' data-oe-model='sale.order' "
|
||||||
|
f"data-oe-id='{self.original_order_id.id}'>#{self.original_order_id.name}"
|
||||||
|
f"</a>."
|
||||||
|
)
|
||||||
|
new_order.message_post(body=new_msg_body)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"type": "ir.actions.act_window",
|
"type": "ir.actions.act_window",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue