Created
July 25, 2017 10:17
-
-
Save tienhieuD/24f315fd59371af207a5e13209354ad0 to your computer and use it in GitHub Desktop.
Tạo một res_users mới
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Users(models.Model): | |
_name = 'solienlac.taikhoan' | |
# _inherit = 'res.users' | |
login = fields.Char() | |
password = fields.Char() | |
@api.model | |
def create(self, values): | |
# Code chinh day ne | |
vals = { | |
'name':"user", | |
'login':'user@gmail.com', | |
'company_ids':[1], | |
'company_id':1, | |
'new_password':'12345' | |
} | |
self.env['res.users'].sudo().create(vals) | |
# Deo lien quan dau kemeno | |
user = super(Users, self).create(values) | |
return user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment