Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

HTML in the chatter

Odoberať

Get notified when there's activity on this post

This question has been flagged
2 Replies
1858 Zobrazenia
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
Zrušiť
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
Zrušiť
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
Zrušiť
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!

Registrácia
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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