Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
2
Respuestas
7842
Vistas
Hi, try this for V8 onchange api.
@api.onchange('field_name')
def onchange_field_name(self):
value = self.field_name if self.field_name else 'Nothing'
return {'value': {'field_name': value}}
You can return the value in self itself like,
@api.onchange('field_name')
def onchange_field_name(self):
self.message = "Dear %s" % (self.field_name or "")
The second approach works, but only for the field that triggered the onchange. If I want to update another field (a different column in a tree view) nothing happens. The first approach with the dictionary I'm not able to make work at all, I've looked at the response in Chrome and the values returned are the fields that have been modified in the onchange.
Hi,,
onchange method should return a dictionary in following format :- Eg:
{
'warning': {'Your Message'},
'value': {'field_name1': VALUE , 'field_name2': VALUE, 'field_name3': VALUE}
}
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Registrarse
Seems the forum has some bugs, I was unable to enter text for the question. I'm on V8 so I'm after what has changed from V7 to V8. I have tried returning {'value' : {'fieldname etc... but the response that is returned to the client has another dictionary for 'value', with only some of the values changed in this onchange method.