Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1491 Widoki

Hello, 

I have a form for Syllabus. In that form i have a Many2one field for Standard(such as playgroup,nursury,metric,four,five) for classes and a Many2one field for "Subjects". Each standard has some subjects in his Line portion. I want that when I select a specific standard from Syllabus form..then on list of subjects which is defined in that standard should be displayed in Subject field.

Please help.

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,
For this you can return the domain for the second field from the on-change of the first field. See an example:

@api.onchange('partner_id')
def onchange_partner_id(self):
for rec in self:
return {'domain': {'order_id': [('partner_id', '=', rec.partner_id.id)]}}

This is onchange written for the partner_id field, and order_id is many2one field of sale order, so once partner is selected the domain for the order_id field is to show only the sale orders of selected partner.

Video : How To Give Domain For A Field Based On Another Field

Thanks

Awatar
Odrzuć