Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1730 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 25
1755
0
thg 10 24
1377
0
thg 11 23
1848
1
thg 8 22
2618
0
thg 8 22
2149