Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
4202 Представления

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?

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Лучший ответ

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)


Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
авг. 25
2431
1
июл. 25
920
1
авг. 25
1151
0
мая 25
1360
2
апр. 25
3573