Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
4193 Vues

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

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

Avatar
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
2
août 25
2410
1
juil. 25
909
1
août 25
1151
0
mai 25
1344
2
avr. 25
3567