跳至内容
菜单
此问题已终结
2 回复
1743 查看

Hi all, is there a way to create a user from a contact without installing the mail odoo app ? Because I want to have this feature in my odoo integration but I don't want a mail service in it, for example coding something or maybe editing a module.

形象
丢弃
编写者 最佳答案

thanks for the help, but im trying this code and its not creating new users i dont know why?

形象
丢弃
最佳答案

Hi,

If you are familiar with code you can achieve this by over riding the create function of model res.partner, super it and create the user.

class ResPartner(models.Model):
_name = 'res.partner'
_inherit = 'res.partner'

@api.model
def create(self, vals):
res = super(ResPartner, self).create(vals)
for rec in res:
user = self.env[‘res.users’].sudo().create({
‘name’: rec.name,
‘login’: rec.email,
‘partner_id’: rec.id
)}
return res

Regards

形象
丢弃
相关帖文 回复 查看 活动
1
8月 25
1771
0
10月 24
1382
0
11月 23
1854
1
8月 22
2620
0
8月 22
2150