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

In my code, I've write defalut_get method and it is perfectly working when I create new record. but, when I open existing record default value is not showing

here is my code:

@api.model
def default_get(self, fields):
    print('fields ------------', fields)
    res = super(SalesTarget, self).default_get(fields)
    activity_stage_target_ids = [(5, 0, 0)]
    stage_rec = self.env['crm.stage'].search([])
    for stage in stage_rec:
        line = (0, 0, {
            'stage_id': stage.id
        })
        activity_stage_target_ids.append(line)
res.update({
'activity_stage_target_ids': activity_stage_target_ids,
})
return res


아바타
취소
베스트 답변

Hello, @Roshan Pandey

Hope you are doing well,

- default_get method works only when you create new record , 
for you to update existing record you need to use compute method or xmlrpc.

Hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

아바타
취소