I have seen in some Odoo files:
from ..models import MAGIC_COLUMNS
What are these columns? Why are they considered magical?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have seen in some Odoo files:
from ..models import MAGIC_COLUMNS
What are these columns? Why are they considered magical?
Magic Columns are fields that Odoo manages exclusively - like magic - without any user intervention required.
They are defined at https://github.com/odoo/odoo/blob/11.0/odoo/models.py#L187
LOG_ACCESS_COLUMNS = ['create_uid', 'create_date', 'write_uid', 'write_date']
MAGIC_COLUMNS = ['id'] + LOG_ACCESS_COLUMNS
In some cases, other field names are added to this list:
parent_left
parent_right
__last_update
You don't have to worry about them - they are created and populated automatically when needed.
When you make your own fields for models, you just can't use any Magic Field names, or any of the following Reserved field names:
name
active
sequence
state
parent_id
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati