Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
7310 Vizualizări
@api.onchange("name_teacher")
def _onchange_name_teacher(self):
for rec in self:
return{
'domain': {'name_subject': [('name_teacher', 'in', rec.name_teacher.name_subject.ids)]}
}


error:

WARNING odoo16 odoo.models: onchange method TeacherSubject._onchange_name_teacher 

returned a domain, this is deprecated


No data is showing on table

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

Returning a domain using onchange method has been deprecated in Odoo 14.


The standard way is to use a computed field as below:

https://github.com/odoo/odoo/pull/41918#issuecomment-824946980


Imagine profil
Abandonează

Thank you Waleed for this information and the link to the OCA module.

If the capability of returning a domain from an onchange method has been deprecated, is this OCA module the "standard" way to do this type of thing?

My use case is that I have a dropdown list of values (pricelists) and I want to filter the list to those that meet certain qualifications based on the partner that has been selected. I need to be able to change the domain on that field based on the partner selected.

Odoo didn't mention what should we use, but the standard solution is to use fields domain parameter:
For more details, You can check the below link for this case:
https://github.com/odoo/odoo/pull/41918

Related Posts Răspunsuri Vizualizări Activitate
2
iul. 23
5187
2
feb. 23
3777
1
mai 25
1577
1
apr. 25
2740
1
apr. 25
3504