Skip to content

Commit

Permalink
fix: validations for Raven User
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkothari22 committed Mar 29, 2024
1 parent 102a6fd commit bec74e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions raven/raven/doctype/raven_user/raven_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ def before_validate(self):
if not self.full_name:
self.full_name = self.first_name

def validate(self):
if self.type == "Bot" and not self.bot:
frappe.throw(_("Bot is mandatory"))

if self.type == "User" and not self.user:
frappe.throw(_("User is mandatory"))

def before_save(self):
if self.type != "Bot":
self.update_photo_from_user()
Expand Down

0 comments on commit bec74e0

Please sign in to comment.