콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1923 화면

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. 

아바타
취소
베스트 답변

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

아바타
취소

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)

관련 게시물 답글 화면 활동
5
9월 25
21272
3
8월 25
3049
1
5월 25
2938
1
4월 25
3921
1
4월 25
4781