How to Use Log Access Attribute in Odoo 17

CelineGeorge1 644 views 10 slides Jul 31, 2024
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

In every Odoo model, we notice certain fields automatically recognized by the system, even if we didn't explicitly inherit them. These fields include create_uid, create_date, write_uid, and write_date.


Slide Content

How to use _log_access attribute in Odoo Enterprise

Introduction Enterpr ise In every Odoo model, we notice certain fields automatically recognized by the system, even if we didn't explicitly inherit them. These fields include create_uid, create_date, write_uid, and write_date. They are part of the _log_access attribute and play a significant role in tracking data changes and user interactions within the system.

Enterprise In Odoo, the _log_access attribute is automatically set to true when creating a new model. This attribute facilitates the automatic storage of fields like create_uid, create_date, write_uid, and write_date. Let's take a look at a newly developed model and its associated view.

Enterprise I've also included some additional fields that don't include the default create_uid, create_date, write_uid, and write_date."

Enterprise Let's see how the _log_access attribute functions. Odoo automatically includes additional fields other than the fields that i have added through the code, as shown in the following screenshot.

Enterprise create_uid: The user who created the record. create_date: The date and time when the record was created. write_uid: The user who last updated the record. write_date: The date and time when the record was last updated. In Odoo, the _log_access attribute is set to "True" by default. This means when a record is created, these fields are automatically populated.

Enterprise We can stop the automatic creation and updating of these fields. By setting "_log_access = False", Odoo will not auto-update or create the fields create_uid, create_date, write_uid, and write_date.

Enterprise Let's check it by creating another record. The predefined fields will not be stored and will be marked as empty, as shown in the image.

Enterprise As we know, predefined fields like create_uid, create_date, write_uid, and write_date are crucial for executing methods accurately in Odoo. By default, Odoo sets _log_access = True to track these fields. However, setting _log_access = False can interrupt method execution by not updating these fields automatically. Understanding the importance of these fields and attributes is essential for efficient program execution.

For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com