While Creating Contract if a contract does n't have any contract\_lines then Contract should not be created. in case a contract is created and while editing all contract\_lines has to be deleted then the contract should not be updated and raise user error. I resolved the first condition but don't know how to solve 2nd condition. Here is my code. Thanks.

```
@api.model
def create(self, vals):
    if len(vals['contract_lines']) == 0:
        raise UserError(_("Without Charges, Contract should not be saved"))
    return super(transport, self).create(vals)

```

i'm applying same methodalogie on write,update method it's not working. it's not raising any user error also.