Skip to content

Instantly share code, notes, and snippets.

@ofelix03
Last active November 5, 2022 21:13
Show Gist options
  • Save ofelix03/820e80fb894e635ede9e7d7599dac6d5 to your computer and use it in GitHub Desktop.
Save ofelix03/820e80fb894e635ede9e7d7599dac6d5 to your computer and use it in GitHub Desktop.
@api.model
def create(self, vals):
try:
# if user has right permission, continue with create operation
return super(Customer, self).create(vals)
except AccessError:
raise ValidationError(_("Sorry! you don't have the right permission to create this record"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment