Question: I have three lists. What I want to do is look for 3rd item in TempTree and if this item is not present in the Set then I want to append this third item into STree.

I will be using a `for` loop `TempTree[i]` from `i[2:]`.

Given Data:

```
TempTree = [(3.0, 5.0), (1.0, 7.0), (5.0, 4.0), (3.0, 4.0), (0.0, 7.0), (1.0, 2.0), (7.0, 8.0), (2.0, 3.0), (8.0, 6.0), (0.0, 1.0), (2.0, 5.0), (2.0, 8.0), (6.0, 5.0), (7.0, 6.0)]
Set = [(3.0, 5.0), (5.0, 3.0), (1.0, 7.0), (7.0, 1.0)]
SpanningTree = [(3.0, 5.0), (1.0, 7.0)]

```

My Code:

```
for x in TempTree[2]:
    for y in Set:
        if x != y:
            SpanningTree.append(TempTree[2])
print(SpanningTree)

```

My result:

```
[(3.0, 5.0), (1.0, 7.0), (5.0, 4.0), (5.0, 4.0), (5.0, 4.0), (5.0, 4.0), (5.0, 4.0), (5.0, 4.0), (5.0, 4.0), (5.0, 4.0)]

```

Required Result:

```
[(3.0, 5.0), (1.0, 7.0), (5.0, 4.0)]

```

Answer: 
With version odoo 10.0

> 
> Solution applicable to one2many and many2many too :)
> 
> 
> 

class res\_partner(models.Model):
 \_inherit = "res.partner"

```
sb_sector_id = fields.Many2one('sb.business_sector',string="Business Sector" )
sb_categories_id = fields.Many2many('sb.business_categories','rel_sb_business_cates','confirm_id','status_id', string='Business Categories', required=False)

sb_activity_id = fields.Many2many('sb.business_activties','rel_sb_business_activties','confirm_id','status_id', string='Neclamenture of activities', required=False)

@api.onchange('sb_sector_id')
def onchange_sb_sector_id(self):
    return {'domain':{'sb_categories_id':[('sector_id','=',self.sb_sector_id.id if self.sb_sector_id else False)]}}

```

Mainly in return you had to write domain with field and give domain value.

```
return {'domain':{'sb_categories_id':[('sector_id','=',self.sb_sector_id.id if self.sb_sector_id else False)]}}

```
You can try [this link](https://www.odoo.com/forum/how-to/developers-13/what-should-onchange-methods-do-and-return-57760),

**Example**:

```
'insp_rslt' : fields.one2many('feedback.tree','insp_rsltts','Inspection Result', domain=[('valuess', '=', 'as u like string')])

```