Skip to content

Instantly share code, notes, and snippets.

@tienhieuD
Created July 25, 2017 10:17
Show Gist options
  • Save tienhieuD/24f315fd59371af207a5e13209354ad0 to your computer and use it in GitHub Desktop.
Save tienhieuD/24f315fd59371af207a5e13209354ad0 to your computer and use it in GitHub Desktop.
Tạo một res_users mới
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