Enable Dark Mode!
By: Nafih VK

How to Configure the Log Access Attributes in Odoo

Technical Odoo 15

You know the necessity of fields and attributes in Odoo. Execution and manipulation of areas and data are more critically important than defining a space than just showing the fields in Odoo.

There are many model-level attributes in Odoo; we will explain one of the model-level attributes in Odoo. Did you ever think about _log_access details that exist in every model in Odoo? From the backend side, we can see a few fields automatically recognized by Odoo, which we didn’t inherit. The areas are as follows: create_uid, create_date, write_uid, write_date. For better understanding, let me explain with examples.

During the creation of any model, the _log_access attribute was true by default; it stores the fields create_uid, create_date, write_uid, write_date automatically if the quality is true. Here I have developed a new model, and its view is as follows.


Moreover, I have added a few fields that don't contain create_uid, create_date, write_uid, and write_date.


Let us see it works in the _log_access attribute,
I have added three fields by this code, but Odoo will take extra fields using _log_acccess as the following image.


Create_uid : Stores who created the record
Create_date : Stores when the record was created
Write_uid : Stores who last updated the record
Write_date: Stores when the record was last updated
In Odoo, the _log_acccess attribute is “True” by default.  When we create a single record in Odoo, it will be stored below.


Here we can stop the auto update or creation of these fields.  Let us check if “ _log_acccess = False “. By defining the boolean attribute “_log_acccess = False “, Odoo will stop the auto update or creation of below fields create_uid, create_date, write_uid, write_date. Let us try our code.

class BooksLibrary(models.Model):
   _name = 'books.library'
   _log_access = False
   name_of_book = fields.Char(string="Name of Book")
   price = fields.Float(string="price")
   author = fields.Char(string="Author")

As you see in the code,  It was defined as log access = True, and once we create a record, there will not store predefined fields as we mentioned on top. It is marked as empty, as shown in the image.



When we are trying to show create_uid, create_date, write_uid, write_date  fields in the frontend, we will face an error. In addition, we cannot offer these fields into the Odoo frontend due to the definition of _log_access = False.   

This will restrict access to these fields. The above example defines models which are already loaded. Let us try to define the new model with false on newly loaded. 

class BooksOrder(models.Model):
   _name = 'books.order'
   _log_access = False
   customer_id = fields.Many2one('res.partner', string="Customer Name")
   name_of_book = fields.Char(string="Name of Book")
   price = fields.Float(string="price")
   author = fields.Char(string="Author") 

The above code is predefined _log_access = False in the model; once it defines “False” before loading the model, It will not recognize the following fields: create_uid, create_date, write_uid, write_date.  And database structure as shown image with defined areas.


As you probably are aware, there are huge chances to use defined fields and manipulate them to another execution. From the developer side, It should get to the essential fields to execute methods for the efficient and accurate running of programs.  Therefore Odoo is defined log_access = False by default. Because created_at, created_at, write_uid, write_date fields are used many in Odoo. Once we enable this attribute into "False", It indeed happens and interrupts the execution of methods. Hope to become mindful of the meaning of fields and attributes.

If you need any assistance in odoo, we are online, please chat with us.


Leave a comment




Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Limited
Alpha House,
100 Borough High Street, London,
SE1 1LB, United Kingdom



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message