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

Hello there, it's possible to make a many2many field required ?

Thanks you !

Аватар
Отменить
Автор

The only thing I see for my problem is :

Redefine create and write et add constrains. It's the only thing I can do ?

Автор

Hello, it doesn't work for me, it's that for this reason I have created this request. :'(

Thanks anyway.

Лучший ответ

try fields_to_use = fields.Many2many('model.model', 'field_names_model', required=True)

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

You Can Use len() function in pythin, 

Eg: 

if len(self.Many2mnay_filed) == 0:
raise UserError(_('Please Add Many2many Field'))

Аватар
Отменить