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

I'm having many2one which has relation "res.currency". I need to set default currency value in Indian currency by default and set this field must not change by user. How must I do this?

Awatar
Odrzuć
Najlepsza odpowiedź

currency_id = fields.Many2one('res.currency',default=lambda self: self.env['res.currency'].search([('name', '=', 'INR')]).id,readonly=True)

Awatar
Odrzuć
Najlepsza odpowiedź

You can get the currency using xml_id rather name 

def _default_country_id(self):
    return self.env.ref('base.INR').id

currency_id = fields.Many2one('res.currency',string='Currency',default=_default_country_id,readonly=True)


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
sie 25
2409
1
lip 25
909
1
sie 25
1151
0
maj 25
1344
2
kwi 25
3567