Odoo Help

joseph d'souza
On 8/13/13, 8:57 AM

Yes let say one scenario like you want to track the visibility of invoice related for ex : invoice is created , invoice is validated, invoice is paid etc..

You can set a mail.message.subtype that depends on an other to act through a relation field. Here is an Account-related subtypes for track visiblity

    <record id="mt_invoice_validated" model="mail.message.subtype">
        <field name="name">Validated</field>
        <field name="res_model">account.invoice</field>
        <field name="default" eval="False"/>
        <field name="description">Invoice validated</field>

    <record id="mt_invoice_paid" model="mail.message.subtype">
        <field name="name">Paid</field>
        <field name="res_model">account.invoice</field>
        <field name="default" eval="False"/>
        <field name="description">Invoice paid</field>

Your object need to inherit from mail.thread. for traking the visiblity which produces the messages

If an object is inherited from 'mail.thread' then _track is used to send notifications. Therefore 'module.subtype_xml' is the related "Message Subtype". These subtypes have to be declared in XML. Here is an example:

<record id="subtype_xml" model="mail.message.subtype"> <field name="name">Relevant Fields</field> <field name="res_model">account.invoice</field> <field name="default" eval="True"/> <field name="description">some descriotion.</field> </record>

thanks but I need to understand how track_visibility is used in py file

'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, track_visibility='onchange', states={'draft':[('readonly',False)]}),

its available in account_invoice.py

Atchuthan - Technical Consultant, Sodexis Inc
on 8/13/13, 11:13 AM

Hello friend can i get automatically created message id i want to change that message

Vinod Kumar
on 3/2/16, 1:10 AM
On 5/23/15, 10:39 PM

To understand the logic of track_visibility="onchange" you have to see both the python and xml parts of code.

According to the code you sent track_visibility='onchange' in python means that the field attrs will be re-evaluated whenever any "onchange" function is triggered.

So if we assumed that in view we have

<field name = "nationality" /> 
<field name = "user_id" attrs="{'invisible': [('nationailty', '=', 'Egyptian')]}" />

The field user_id will only appear if the nationality field (changed) to be Egyptian.

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 8/13/13, 6:18 AM
Seen: 18684 times
Last updated: 12/4/18, 2:41 AM