Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
16810 Widoki
Najlepsza odpowiedź

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
Awatar
Odrzuć
Najlepsza odpowiedź

how to get from the ODOO screen itself

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź
self.env.company.currency_id
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 24
1779
2
sty 24
1815
Error message Rozwiązane
2
lis 23
2724
1
mar 24
2056
1
mar 23
2048