# How to resolve this error

**URL:** https://discuss.tryton.org/t/how-to-resolve-this-error/2910
**Category:** Developer
**Created:** [June 23, 2020, 5:06am UTC](https://discuss.tryton.org/t/how-to-resolve-this-error/2910 "2020-06-23T05:06:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![prashasti.sharma](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@prashasti.sharma](https://discuss.tryton.org/u/prashasti.sharma)
#### Post date: [June 23, 2020, 5:06am UTC](https://discuss.tryton.org/t/how-to-resolve-this-error/2910/1 "2020-06-23T05:06:46Z")

</div>

The code I have done is followed below:

```auto
    is_beneficiary = fields.Function(fields.Boolean(
        'Is Beneficiary'), 'on_change_is_beneficiary')
    @fields.depends('is_beneficiary', 'bank_branch')
    def on_change_is_beneficiary(self, name=None):
        if self.is_beneficiary:
            if (self.bank_branch is None):
                self.raise_user_error('Bank Details Need to be Filled')
            else:
                return self.is_beneficiary

```

On executing the above code error is showing:  
`RecursionError: maximum recursion depth exceeded while calling a Python object`

---

<div class="post-metadata">

### Author: ![bala4901](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@bala4901](https://discuss.tryton.org/u/bala4901)
#### Post date: [June 23, 2020, 5:53am UTC](https://discuss.tryton.org/t/how-to-resolve-this-error/2910/2 "2020-06-23T05:53:59Z")

</div>

It better to separate on\_change with the function method.

Using get\_is\_beneficianry will be better.

And you may consider for the bank details field using states to check boolean if true then required. It will be much more simpler

---

<div class="post-metadata">

### Author: ![sergyo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sergyo/32/181_2.png) [@sergyo](https://discuss.tryton.org/u/sergyo)
#### Post date: [June 23, 2020, 6:26am UTC](https://discuss.tryton.org/t/how-to-resolve-this-error/2910/3 "2020-06-23T06:26:29Z")

</div>

The problem is you are using “is\_beneficiary” value in the method that computes “is\_beneficiary” value. So it gets on an infinite loop.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [June 23, 2020, 7:56am UTC](https://discuss.tryton.org/t/how-to-resolve-this-error/2910/4 "2020-06-23T07:56:43Z")

</div>

Also you can not raise error in an `on_change*` method.
