Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

HTML in the chatter

Naroči se

Get notified when there's activity on this post

This question has been flagged
2 Odgovori
1868 Prikazi
Avatar
Daniel Martinez

auth_num = response_json["uuid"]

invoice_link =  f"https://report.feel.com.gt/ingfacereport/ingfacereport_documento?uuid={auth_num}"

message =  f"Watch invoice"


invoice.message_post(

​body=message,

​author_id=self.env.ref("base.partner_root").id,

​subject="Certified Invoice",

​message_type="comment",

​subtype_xmlid="mail.mt_comment"

)


My code is not interpreted correctly, as my message does post to the chatter, but the link is seen as plain text and not as a link.

 

1
Avatar
Opusti
Rene Heuven

Did you solve this? I got the same problem.

Aurélien Kinet

Same issue here.

I am using a webhook to create a log message in the chatter


Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

Please Update Your code like this,


from markupsafe import Markup


auth_num = response_json["uuid"]

invoice_link = Markup('https://report.feel.com.gt/ingfacereport/ingfacereport_documento?uuid= %s') % (auth_num)

message = Markup('Watch invoice: <a href="{invoice_link}" target="_blank">%s</a>') % (invoice_link)


invoice.message_post(

    body=message,

    author_id=self.env.ref("base.partner_root").id,

    subject="Certified Invoice",

    message_type="comment",

    subtype_xmlid="mail.mt_comment"

)


Hope it helps.

0
Avatar
Opusti
Avatar
Christoph Farnleitner
Best Answer

For Odoo 18 at least, you could define a template and use it with message_post_with_source(). Pass on any values you want to render within that template in the render_values dict.

self.with_user(sender_user_id).message_post_with_source(
'your_module.your_message_template',
render_values={'self': self, 'message': message, 'title': title, 'message_type': message_type,
'message_tag': message_tag, 'data': json.dumps(data), 'url': url,
'some_result': some_result},
subtype_xmlid='mail.mt_note',
)


<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="your_message_template">
<p>
<span t-attf-class="badge text-#{message_type}"
style="border: 1px solid; border-radius: 10px;"
t-esc="message_tag"/> <t t-if="title"><t t-esc="title"/></t><br t-if="message"/>
<t t-esc="message"/>
</p>
<blockquote>
<span class="fst-normal"><b>URL:</b> <t t-esc="url"/></span><br/>
<span class="fst-normal"><b>Request:</b> <br/><code t-esc="data"/></span><br/>
<b class="fst-normal">Response:</b> <br/><t t-esc="some_result"/>
</blockquote>
</template>
</odoo>


Results in:

Since it's a template, go wild

0
Avatar
Opusti
Tom Rubino

Hey all, trying to do this directly in Studio Python...

snippet from my code
--------------------------

elif eachdoc.x_studio_action=="Create New":
_logger.info("Create needed on documents:")
_logger.info(eachdoc.name)

# Create Doc Link record
vals = {
'x_studio_related_part': record.product_tmpl_id.id,
'x_name': eachdoc.name,
}
new_doc_link = env['x_document_links'].create(vals)

record.message_post_with_source(
'mail.message_origin_link',
render_values={'self': record, 'origin': new_doc_link},
subtype_xmlid='mail.mt_note',
)

--------------------------

This creates the message just fine but of course uses the template language.

Can I define a template locally inside the code to override (mail.message_origin_link)?

Perhaps something like

mail.message_origin_link_custom = """
<p>
<span t-attf-class="badge text-#{message_type}"
style="border: 1px solid; border-radius: 10px;"
t-esc="message_tag"/> <t t-if="title"><t t-esc="title"/></t><br t-if="message"/>
<t t-esc="message"/>
</p>
<blockquote>
<span class="fst-normal"><b>URL:</b> <t t-esc="url"/></span><br/>
<span class="fst-normal"><b>Request:</b> <br/><code t-esc="data"/></span><br/>
<b class="fst-normal">Response:</b> <br/><t t-esc="some_result"/>
</blockquote>
"""

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now