Skip to Content
Menú
This question has been flagged
2 Respostes
4190 Vistes

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?

Avatar
Descartar
Best Answer

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

Avatar
Descartar
Best Answer

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)


Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
d’ag. 25
2410
1
de jul. 25
909
1
d’ag. 25
1151
0
de maig 25
1344
2
d’abr. 25
3567