Se rendre au contenu
Menu
Cette question a été signalée
4 Réponses
16697 Vues


Avatar
Ignorer
Meilleure réponse

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
Ignorer
Meilleure réponse

how to get from the ODOO screen itself

Avatar
Ignorer
Meilleure réponse

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
Ignorer
Meilleure réponse
self.env.company.currency_id
Avatar
Ignorer
Publications associées Réponses Vues Activité
1
avr. 24
1646
2
janv. 24
1738
2
nov. 23
2625
1
mars 24
1969
1
mars 23
1981