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

I want to make the creator of the contact as salesperson automatically as they normally forgot to add. It is required field now but normally the creator just choose any user id. 

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

Hi Aklili Lamudok,


For this, you can add code like this in create method of 'Contact' model.

Please find code in comment. 

Feel free to contact us for further assistance

Hope this answer helps you.

Thanks & Regards,
Email: odoo@aktivsoftware.com     

Skype: kalpeshmaheshwari

Ảnh đại diện
Huỷ bỏ

Please find code example here :-

EX:

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

@api.model
def create(self, values):
# If the user_id is not provided, set it to the creator's user_id
if 'user_id' not in values:
values['user_id'] = self.env.uid

return super(ResPartner, self).create(values)

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 8 25
2612
1
thg 5 25
2645
1
thg 4 25
3635
1
thg 4 25
4492
1
thg 4 25
1961