I was wondering how to set field attributes (invisible, readonly, domain, ...) in form via @api.onchange (as it was returning the attributes from the method in v7)?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- Müşteri İlişkileri Yönetimi
- e-Commerce
- Muhasebe
- Envanter
- PoS
- Project
- MRP
Bu soru işaretlendi
Hi Nedas,
Right now in onchange no need to return anything(in new api), but there is a case when we want to return some warning, domain or other stuff. So, in this case we can return as old api style like.
--------------------------------------------------
@api.onchange('my_field')
def onchange_my_field(self):
msg={}
self.my_other_field = self.my_field #Here just copy whatever come with my_field into my_other_field
if (self.warning==True):
msg = { 'title': _('Waning!'), 'message' : 'You have just copy my field into my other field...'
}
return {'warning': msg}
-----------------------------------------------
same way we can return other stuff.
Hope this will help u as u want...
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Olİlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
---|---|---|---|---|
Text after the field in a form
Çözüldü
|
|
2
Ara 23
|
17417 | |
|
1
Mar 15
|
5890 | ||
|
3
Ağu 23
|
6860 | ||
|
2
May 16
|
8751 | ||
|
2
Oca 16
|
5096 |