Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
1486 Vizualizări

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.

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează