Ir al contenido
Menú
Se marcó esta pregunta
In odoo16 I have dynamically created a few buttons on the formview.
Onclick of the button an rpc call is made:

rpc.query({
model: 'name.of.the.model',
method: 'update_field_from_button',
args: [[],recordId,name],})


below is the function called using rpc:

def update_field_from_button(self, record_id, name):
if record_id and name:
record = self.browse(record_id)
record.write({'name': name})


also for reference, the form view on which the above two code segments are working is called like this:

form = self.env['name.of.the.model'].create({})
return {
'name': "End Task",
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'name.of.the.model',
'res_id': form.id,
'target': 'new',
}

P.S.- this is not a transient model, just a "model" although it opens like a wizard via the above return statement.


I have checked the values of the field of that particular record, (via terminal) and it is getting updated there (on click of the button).
But the values don't appear in the form view when this updation takes place.

how do I solve this?

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
may 24
1722
0
jul 15
4004
0
may 24
837
0
may 24
19
1
feb 21
3551