Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to Notify a Discuss Channel when New Lead is created AND include link to Lead record

Subscriure's

Get notified when there's activity on this post

This question has been flagged
leadsnotificationdiscussionautomationchannel
2 Respostes
3502 Vistes
Avatar
Diggi Admin
FUNCTIONALITY:
I would like to notify users in a discussion channel every time a new lead is created, including the link to the newly created record. I am doing this for a client who has Odoo SAAS (so, no access to source code on a deployment I control)


METHOD:
To do so, I am triggering a python code from an automated action in the CRM.LEAD. I would like to do this for leads, but I can't quite find a trigger that triggers when a new lead is created. (I can't see On Create available for leads) so I am doing this when the stage is NEW.

PROBLEM:
With that said, the issue is that I don't seem to be able to include the URL in the text body that resolves to the record.

PYTHON CODE Associated to Action:


#Find the channel by name channel = env['discuss.channel'].search([('name', '=', 'biz-dev')], limit=1) # Post the message to the found channel if channel: for lead in records: lead_url = f'/web#id={lead.id}&view_type=form&model=crm.lead' notification = f'
View Lead: {lead.name}
' # Build the message content with the link message_content = ( f"New lead created: {lead.name}\n" f"Contact Name: {lead.contact_name}\n" f"Phone: {lead.phone}\n" f"Description: {lead.description}\n\n{notification}" ) # Post the message to the discussion channel channel.message_post( body=message_content, subtype_xmlid='mail.mt_comment' ) else: # Handle the case where the channel is not found print(f"Channel with name 'biz-dev' not found.")


0
Avatar
Descartar
Avatar
Ray Carnes (ray)
Best Answer

First, use On save as the Trigger and Created on in When updating ​

Next, use the following code as a guide:




3
Avatar
Descartar
Avatar
Norman Uittenbogaart
Best Answer

I can't seem to be able to get it to work, I have the following now, but get a error when putting in a form on the website.

Could you please let me know what could be wrong?

This is added in the automated actions,

#Find the channel by name
channel = env['discuss.channel'].search([('name', '=', 'algemeen')], limit=1)

# Post the message to the found channel
if channel:
    for lead in records:
        lead_url = f'lead.id} ">View Lead'
        notification = f'View Lead: {lead.name}'

        # Build the message content with the link
        message_content = (
            f"New lead created: {lead.name}\n"
            f"Contact Name: {lead.contact_name}\n"
            f"Phone: {lead.phone}\n"
            f"Description: {lead.description}\n\n{notification}"
            f"{lead_url}\n"
        )

        # Post the message to the discussion channel
        channel.message_post(
            body=message_content,
            message_type= 'comment',
            subtype_xmlid='mail.mt_comment',
            body_is_html=True
        )
else:
    # Handle the case where the channel is not found
    print(f"Channel with name 'algemeen' not found.")
0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
Completar fecha mediante automatización o código
leads datetime automation
Avatar
2
d’oct. 24
49
Gitlab integration with discuss Solved
notification discussion gitlab
Avatar
Avatar
1
de maig 18
6707
Contact Form assign salesperson and notify via Email Solved
form contacts leads automation
Avatar
Avatar
Avatar
Avatar
3
de des. 23
9731
Automated Action - Notify All Channel Participants of All New Messages
python notifications discussion automation channels
Avatar
Avatar
1
de gen. 25
5134
[Odoo > 8.0]How to enable email-notifications on lead creation from the website contact form? Solved
email leads notification contactus 9.0
Avatar
Avatar
2
de gen. 24
14015
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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