Reputation: 1659
I have two fields. One field depends on other field. Second field have a domain which check condition based on the first field's selected value. So if the user do not selected the first field and trying to select the second field, then it should show a message that, select first field. [I tried using required=True
but it will give message after when I am trying to save the record.]
roomType = fields.Selection([('meeting','Meeting Room'),('discussion','Discussion Room')])
meeting_room=fields.Many2one(comodel_name='mroom',string="select the room",required=True,domain='[("roomType","=",roomType)]')
Upvotes: 1
Views: 235
Reputation: 81
you can use alternative solution.
Initially make meeting_room field invisible or readonly. Now use attrs on roomType field which will make meeting_room visible. in this way you will have roomType value for domain of meeting_room field.
Upvotes: 1