Skip to Content
मेन्यू
This question has been flagged
4 Replies
16812 Views
Best Answer

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
Avatar
Discard
Best Answer

how to get from the ODOO screen itself

Avatar
Discard
Best Answer

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,
 }

Avatar
Discard
Best Answer
self.env.company.currency_id
Avatar
Discard
Related Posts Replies Views Activity
1
अप्रैल 24
1780
2
जन॰ 24
1815
2
नव॰ 23
2726
1
मार्च 24
2056
1
मार्च 23
2049