コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
16807 ビュー


アバター
破棄
最善の回答

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
1774
2
1月 24
1814
Error message 解決済
2
11月 23
2718
1
3月 24
2053
1
3月 23
2048