Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

How to post a change log message for relational One2many fields?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
10.0
3 Odpowiedzi
8766 Widoki
Awatar
Yousef Al-Hadhrami

Dear Community,

I have the o_chatter located on the main record view to post changes to fields

<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
<field name="message_ids" widget="mail_thread">
</div>

Right now when I change char fields such as name, it will post a message on the chatter saying that 

Name: Yousef  Al-Hadhrami Ali Al-Hadhrami                       

but when I change a relational field such as employee family which is a relational field, it will only post ids instead of contents


This is the One2many field

class HrEmployeeFamily(models.Model):
_inherit = 'hr.employee'
employee_family_ids = fields.One2many(
string="Family",
comodel_name='hr.employee.family',
inverse_name='related_employee'
)

and let's say this is the family model:

class EmployeeFamily(models.Model):
_name = 'hr.employee.family'
_inherit = 'employee.record'

related_employee = fields.Many2one('hr.employee', string="Related Employee")
family_name = fields.Char(track_visibility='onchange')

instead of writing on the chatter 

Family Name:Jack Sporrow  Jack Smith       

it writes the model and ids:

Family Name:hr.employee.family,8

I'd like it to post a full detailed log on what was changed on the relational field, how can I achieve that?

0
Awatar
Odrzuć
Ravi Gadhia

which version are you using?

Yousef Al-Hadhrami
Autor

Version 10

Yousef Al-Hadhrami
Autor

@Ravi, your answer kinda did something but not the thing that it should do

it only shows the record if it was updated

so lets say you had family_name + family_date_of_birth, and you modify one of those, it won't show up on the log because it only shows when a record gets linked to the employee himself.

Yousef Al-Hadhrami
Autor

it only shows the record when it gets linked or unliked from an employee

but if you change something in the record, it won't show on the log because the link haven't changed

Ravi Gadhia

I think you need a related field on the model because currently family_name, family_date_of_birth are not direct model field so it does not reflect it's changing on chatter

Yousef Al-Hadhrami
Autor

I think there is,

related_employee = fields.Many2one('hr.employee', string="Related Employee") is the related field on on Family

employee_family_ids = fields.One2many(

string="Family",

comodel_name='hr.employee.family',

inverse_name='related_employee'

) is the related field on the employee

Yousef Al-Hadhrami
Autor

I found a way to [ost to the parent record that one of the family records is updated, deleted or created

here is what I used (for update only):

@api.multi

def write(self, values):

"""Override default Odoo write function and extend."""

self.env['mail.message'].create({

'body': 'Personal Document ' + self.number + ' Updated',

'model': 'hr.employee',

'res_id': self.employee_ref.id,

'subtype_id': '2',

})

return super(HrEmployeePersonalDocument, self).write(values)

Ravi Gadhia

it seems the current implementation of chatter doesn't track change on one2many field and post-change entry on chatter.

you want to track the change of one2many field (employee_family_ids) on hr.employee

https://github.com/odoo/odoo/blob/10.0/addons/mail/models/mail_tracking_value.py#L35

I talked about related field mean getting a related field on 'hr.employee.family' like

employee_name = fields.Char(related="related_employee.name")

but it will not work because of you want post entry on hr.employee

your solution looks good on change/write of a relevant field of family mode post message on employee model

Awatar
Ravi Gadhia
Najlepsza odpowiedź

can you try after adding _rec_name in`hr.employee.family`

class EmployeeFamily(models.Model):   
     _name = 'hr.employee.family'   
     _inherit = 'employee.record'  
     _rec_name = 'family_name'​

1
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Can't reconcile bank statement line
10.0
Awatar
Awatar
Awatar
Awatar
4
kwi 20
10180
how to use field from same model Rozwiązane
10.0
Awatar
Awatar
1
lis 19
4768
How to fix: "odoo.addons.base.ir.ir_qweb.assetsbundle: This error occured while compiling the bundle 'web.assets_frontend' containing:"?
10.0
Awatar
Awatar
2
lut 18
15361
List view pass context for many2one fields
10.0
Awatar
0
sty 18
9531
App is not appearing in the list Rozwiązane
accounting 10.0
Awatar
Awatar
Awatar
3
cze 24
5081
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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