加用户
def insert(self, info): a = self.env['hr.department'].create({'name': info['orgcode_show']}) b = self.env['hr.employee'].create( {'name': info['USERNAME'], 'department_id': a.id, 'mobile_phone': info['dianhua'], 'work_email': info['email']}) c = self.env['res.partner'].search([('name', '=', info['USERNAME'])], limit=1) c.write({'mobile': info['dianhua'], 'email': info['email']}) d = self.env['res.users'].create( {'partner_id': c.id, 'login': info['LOGINID'], 'password': info['PASSWORD'], 'notification_type': 'inbox'}) b.write({'user_id': d.id}) self._cr.commit()
标签:info,name,self,用户,email,env,odoo,id From: https://www.cnblogs.com/pythonClub/p/17785100.html