2025 m. sausio 7 d., antradienis

Odoo record rules

https://www.cybrosys.com/blog/how-to-create-record-rules-in-odoo-17

https://www.odoo.com/documentation/17.0/developer/reference/backend/security.html#access-rights

Record rules are conditions which must be satisfied in order for an operation to be allowed. Record rules are evaluated record-by-record, following access rights.


Current user id:

user.id

 

Examples:

[
('project_id', '!=', False)
# Check if field is not empty
]

Raw Record Data: account.analytic.line(11842)

  "project_id": [
    1,
    "Vidinis"
  ],

('employee_id', '=', 12) # Only show user with id 12

[
('employee_id.user_id', '=', user.id)
]


['|',('company_id','=',False),('company_id', 'in', company_ids)]


Odoo context

 Modify Odoo Environment | Odoo Self Env in Odoo | Odoo Environment Variables