# How to Define a Domain with Multiple Conditions in Tryton?

**URL:** https://discuss.tryton.org/t/how-to-define-a-domain-with-multiple-conditions-in-tryton/8122
**Category:** Developer
**Created:** [December 13, 2024, 1:22pm UTC](https://discuss.tryton.org/t/how-to-define-a-domain-with-multiple-conditions-in-tryton/8122 "2024-12-13T13:22:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Testing\_tryton](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/t/45deac/32.png) [@Testing\_tryton](https://discuss.tryton.org/u/Testing_tryton)
#### Post date: [December 13, 2024, 1:22pm UTC](https://discuss.tryton.org/t/how-to-define-a-domain-with-multiple-conditions-in-tryton/8122/1 "2024-12-13T13:22:29Z")

</div>

Hello,  
I would like to know how to define a domain with multiple conditions in Tryton. For example, I need to include records based on certain ranges or exclude them based on other conditions. What is the best approach to dynamically create a domain in such scenarios?  
If possible, please provide examples or best practices for handling complex domains with conditions like:

Including records based on age ranges or other criteria.  
Excluding certain values while including others.  
Thank you for your help!

---

<div class="post-metadata">

### Author: ![JCavallo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@JCavallo](https://discuss.tryton.org/u/JCavallo)
#### Post date: [December 13, 2024, 1:40pm UTC](https://discuss.tryton.org/t/how-to-define-a-domain-with-multiple-conditions-in-tryton/8122/2 "2024-12-13T13:40:55Z")

</div>

Hello,

You can combine clauses in domains :

```python
domain = [
    # Age range
    ('age', '>=', 18),
    ('age', '<=', 60),
    # include values
    ('state', 'in', ('draft', 'validated')),
    # exclude values
    ('state', 'not in', ('cancelled', 'paid')),
    ]

```

There are many usable criterions and possibilities, the [full documentation on domains](https://docs.tryton.org/latest/server/topics/domain.html#topics-domain) should help.
