Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1258 Visualizzazioni
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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
mag 24
1686
0
lug 15
3982
0
mag 24
835
0
mag 24
19
1
feb 21
3543