Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to track One2many field in Odoo12?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
odooodoo12
3 Răspunsuri
18323 Vizualizări
Imagine profil
Kabeer KB


I am trying to log the changes on a One2many field using track_visibility='onchange'. But it's not working.

Here is the code:

respartner.py       

      bank_account_ids = fields.One2many('customer.bank.account','partner_id',     string='Account',track_visibility="onchange")

                                                                                                                                                                                                                         account.py


           

 _name = 'customer.bank.account'
_description = 'Partner Bank Account Details'

partner_id = fields.Many2one('res.partner',string="Partner")
name = fields.Integer(string="Account Number",required=True,
    track_visibility="onchange")
bank_id = fields.Many2one('partner.bank',string="Bank",track_visibility="onchange")
branch_id = fields.Many2one('partner.bank.branch',string="Branch",
    track_visibility="onchange")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
0
Imagine profil
Abandonează
Imagine profil
Gokulakrishnan Murugesan
Cel mai bun răspuns

Hi Kabeer,

You cannot able to use track_visibility for one2many field, instead of you can use message_post method.

Consider following example 

class Anything(models.Model):
         _name = 'model.name'
         _inherit = ['mail.thread', 'ir.needaction_mixin']

         name = field.Char()
         main_model = fields.Many2one('main.model')

         @api.model
         def create(self, vals):
                 res = super(Anything, self).create(vals)
                 if vals:
                    message = "Changes info"
                     res.main_model.message_post(message)
                 return res

Thanks.

5
Imagine profil
Abandonează
Imagine profil
Benoit Bertholon
Cel mai bun răspuns

Hello,

for one2many tracking checkout
https://www.dator.lu/blog/blog-1/one2many-tracking-3


0
Imagine profil
Abandonează
Imagine profil
SİNAN DURGUT
Cel mai bun răspuns



class Anything(models.Model):
    _name = 'model.name'
   _inherit = ['mail.thread', 'mail.activity.mixin']

    main_model = fields.Many2one('main.model')


    def _message_log(self, body='', subject=False, message_type='notification', **kwargs):
        super(Anything, self)._message_log(body=body, subject=subject, message_type=message_type,**kwargs)
 
        try:
            tracking_datas = kwargs.get('tracking_value_ids', [])
            value = ""
            for i in tracking_datas:
                value += self.format_change_log(i[2])
            self.main_model.message_post(body=f"Model Id : {self.id} <br><ul>{value}<ul>")
         except:
            pass


    @staticmethod
    def format_change_log(value):
        data = {}
        for i in value.keys():
            if i.startswith('old_value'):
                if not value[i]:
                    data['old_value'] = "False"
                else:
                    data['old_value'] = value[i]
            if i.startswith('new_value'):
                if not value[i]:
                    data['new_value'] = "False"
                else:
                     data['new_value'] = value[i]
        return f"<li>{value['field_desc']}({value['field']}) : {data['old_value'] if 'old_value' in data.keys() else 'False'} -> {data['new_value'] if 'new_value' in data.keys() else 'False'} </li>"
0
Imagine profil
Abandonează
jackadam

not work on odoo 15

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Error: Couldn't load module web Rezolvat
odoo odoo12
Imagine profil
Imagine profil
Imagine profil
3
nov. 24
26432
How I get the current ID of a record ? Rezolvat
odoo odoo12
Imagine profil
Imagine profil
1
apr. 23
6842
Binary field as attachment in mail in Odoo 13 Rezolvat
odoo odoo12
Imagine profil
Imagine profil
2
dec. 22
7706
Odoo 12 raise ValueError("Expected singleton: %s" % record) ValueError: Expected singleton: sale.order.line
odoo odoo12
Imagine profil
Imagine profil
1
nov. 22
4839
Anchor tag call template ID or template name Rezolvat
odoo odoo12
Imagine profil
Imagine profil
1
oct. 22
868
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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