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

I'm having many2one which has relation "res.currency". I need to set default currency value in Indian currency by default and set this field must not change by user. How must I do this?

아바타
취소
베스트 답변

currency_id = fields.Many2one('res.currency',default=lambda self: self.env['res.currency'].search([('name', '=', 'INR')]).id,readonly=True)

아바타
취소
베스트 답변

You can get the currency using xml_id rather name 

def _default_country_id(self):
    return self.env.ref('base.INR').id

currency_id = fields.Many2one('res.currency',string='Currency',default=_default_country_id,readonly=True)


아바타
취소
관련 게시물 답글 화면 활동
2
8월 25
2565
1
7월 25
974
1
8월 25
1151
0
5월 25
1411
2
4월 25
3601