How to Give a Domain for a Field in Odoo 17

CelineGeorge1 738 views 10 slides May 04, 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

This slide will show how to set domains for a field in odoo 17. Domain is mainly used to select records from the models. It is possible to limit the number of records shown in the field by applying domain to a field, i.e. add some conditions for selecting limited records.


Slide Content

How to Give a Domain for a Field in Odoo 17 Enterprise

Introduction Enterpr ise This slide will show how to set domains for a field in odoo 17. Domain is mainly used to select records from the models. It is possible to limit the number of records shown in the field by applying domain to a field, i.e. add some conditions for selecting limited records.

Enterprise Add domain when creating a field Here takes a field activity_type_id from a model mail.activity.plan.template Added domain to the field activity_type_id domain="['|', ('res_model', '=', False), '&', ('res_model', '!=', False), ('res_model', '=', parent.res_model)]"

Enterprise

Enterprise Result :

Enterprise Add domain by using function Create a field and give the domain as a function i.e., domain=_group_hr_expense_user_domain Then define the function

Enterprise For Example:

Enterprise Add domain from the view Create a new field Add domain to the field from the xml view

Enterprise For Example:

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