Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to include project name in task notification message?

Odebírat

Get notified when there's activity on this post

This question has been flagged
projectmessagingnotificationsanalytictask
2 Odpovědi
7074 Zobrazení
Avatar
Raffaele

Hallo

In the task notification messages (eg. "Stage changed...") I would like to include the Project name or, even better, a link to the Project or Analytic Account.

Could anybody point me in the right direction please?


1
Avatar
Zrušit
Avatar
Raffaele
Autor Nejlepší odpověď

I solved by overriding mail.thread message_track method. 

In short:

class mail_thread(osv.Model):

    _inherit = 'mail.thread' def message_track(self, cr, uid, ids, tracked_fields, initial_values, context=None):

        def convert_for_display(value, col_info): if not value and col_info['type'] == 'boolean': return 'False' if not value: return '' if col_info['type'] == 'many2one': return value.name_get()[0][1] if col_info['type'] == 'selection': return dict(col_info['selection'])[value] return value def format_message(message_description, tracked_values): message = '' if message_description: message = '<span>%s</span>' % message_description for name, change in tracked_values.items(): message += '<div> &nbsp; &nbsp; &bull; <b>%s</b>: ' % change.get('col_info') if change.get('old_value'): message += '%s &rarr; ' % change.get('old_value') message += '%s</div>' % change.get('new_value') return message if not tracked_fields: return True for browse_record in self.browse(cr, uid, ids, context=context): initial = initial_values[browse_record.id] changes = set() tracked_values = {} project_name = '' # if browse_record.project_id: try: project_name = '<div>%s</div>' % browse_record.project_id.name \ + '<div>%s</div>' % browse_record.name except: project_name = project_name # generate tracked_values data structure: {'col_name': {col_info, new_value, old_value}} for col_name, col_info in tracked_fields.items(): field = self._fields[col_name] initial_value = initial[col_name] record_value = getattr(browse_record, col_name) if record_value == initial_value and getattr(field, 'track_visibility', None) == 'always': tracked_values[col_name] = dict( col_info=col_info['string'], new_value=convert_for_display(record_value, col_info), ) elif record_value != initial_value and (record_value or initial_value): # because browse null != False if getattr(field, 'track_visibility', None) in ['always', 'onchange']: tracked_values[col_name] = dict( col_info=col_info['string'], old_value=convert_for_display(initial_value, col_info), new_value=convert_for_display(record_value, col_info), ) if col_name in tracked_fields: changes.add(col_name) if not changes: continue # find subtypes and post messages or log if no subtype found subtypes = [] # By passing this key, that allows to let the subtype empty and so don't sent email because partners_to_notify from mail_message._notify will be empty if not context.get('mail_track_log_only'): for field, track_info in self._track.items(): if field not in changes: continue for subtype, method in track_info.items(): if method(self, cr, uid, browse_record, context): subtypes.append(subtype) posted = False for subtype in subtypes: subtype_rec = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, subtype, context=context) if not (subtype_rec and subtype_rec.exists()): _logger.debug('subtype %s not found' % subtype) continue message = project_name + format_message(subtype_rec.description if subtype_rec.description else subtype_rec.name, tracked_values) self.message_post(cr, uid, browse_record.id, body=message, subtype=subtype, context=context) posted = True if not posted: message = format_message(project_name, tracked_values) self.message_post(cr, uid, browse_record.id, body=message, context=context) return True

0
Avatar
Zrušit
Avatar
Tharaka Perera
Nejlepší odpověď

Hi Raffaele,


i'm having the same issue. can you let me know how you edited the mail.thread message_track method?

0
Avatar
Zrušit
Raffaele
Autor

I'll attach a brief sample to my answer. Please use properly the forum tools: this is not an answer, but a comment.

Ivan

Hello Raffaele, I need to do the same thing, can you please tell how? If is possible to extend your answer. Or attach file? Thank you!

Ivan

Ok, was missing this part at top of your code, -> from openerp.addons.mail.mail_thread import mail_thread

from openerp import models, fields, api

class mail_thread(models.Model):

Graham Vickrage

Ivan yours and Raffaele solutions use different APIs. Can you confirm if this works for version 8 as I don't seem to be able to inherit mail.thread. Is this because of this known problem https://stackoverflow.com/questions/31936122/how-to-inherit-mail-thread-abstractmodel-and-override-function-from-this-class-i

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Notification for the user when task is created.
messaging notifications task inbox
Avatar
1
srp 15
5221
Desktop notification for project module Odoo 14
project notifications task desktop v14
Avatar
Avatar
1
kvě 21
5023
Should Analytic Account be on the Vendor Bill from auto generated Purchase Order?
project analytic
Avatar
0
říj 24
1551
v16 Tasks visibility
project task
Avatar
Avatar
1
čvn 23
4127
Create a user who can only see project and task menu Vyřešeno
project task
Avatar
Avatar
1
lis 22
4545
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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