0
votes

I created a custom module where I want to stop the Create button ,which is in tree view, opening the form view. Instead of opening the form view, I would like to show a pop-up to User.Is it possible?

I tried this code :

@api.model
     def onchange(self,values):
        print "on onchange called"
        raise ValidationError('Creation of new record is not allowed.') 
        return False

It shows a pop up but still it opens the form view on clicking the Create button.

1

1 Answers

1
votes

I found the solution :

     @api.model
     def default_get(self,values):
        if 'lte_status' in values:
          raise ValidationError('Creation of new record is not allowed.') 
          return False
        return super(simcard,self).default_get(values)