Skip to content

Instantly share code, notes, and snippets.

@tienhieuD
Created April 23, 2018 14:55
Show Gist options
  • Save tienhieuD/cbbac15609cb5af1902edf28774cd519 to your computer and use it in GitHub Desktop.
Save tienhieuD/cbbac15609cb5af1902edf28774cd519 to your computer and use it in GitHub Desktop.
@api.model
def create_user(self, name, email, pwd):
info = { 'name': name,
'login': email,
'password': pwd,}
try:
self.env['res.users'].sudo().create(info)
return True
except:
return False
@api.model
def create(self, values):
name = values.get('ten_hoc_vien')
email = values.get('email')
pwd = values.get('mat_khau')
self.create_user(name, email, pwd):
return super(hocsinh, self).create(values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment