Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1720 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 25
1741
0
ต.ค. 24
1373
0
พ.ย. 23
1847
Sell Price / Price per Weight แก้ไขแล้ว
1
ส.ค. 22
2618
0
ส.ค. 22
2147