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


아바타
취소
베스트 답변

The company model (res.company) has a many2one to the company currency, so in v8 and later you can use:

self.env.ref('base.main_company').currency_id
아바타
취소
베스트 답변

how to get from the ODOO screen itself

아바타
취소
베스트 답변

Hi,

You can do as following:

    def _get_currency(self, cr, uid, context=None):
        user_obj = self.pool.get('res.users')
        currency_obj = self.pool.get('res.currency')
        user = user_obj.browse(cr, uid, uid, context=context)

        if user.company_id:
            return user.company_id.currency_id.id
        else:
            return currency_obj.search(cr, uid, [('rate', '=', 1.0)])[0]
_defaults = {      
        'currency': _get_currency,
 }

아바타
취소
베스트 답변
self.env.company.currency_id
아바타
취소
관련 게시물 답글 화면 활동
1
4월 24
1589
2
1월 24
1696
Error message 해결 완료
2
11월 23
2531
1
3월 24
1845
1
3월 23
1911