Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
4222 Visualizações

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
Cancelar
Melhor resposta

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

Avatar
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
2
ago. 25
2532
1
jul. 25
950
1
ago. 25
1151
0
mai. 25
1395
2
abr. 25
3591