跳至内容
菜单
此问题已终结
4 回复
16741 查看
最佳答案

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
1686
2
1月 24
1763
Error message 已解决
2
11月 23
2661
1
3月 24
1993
1
3月 23
2010