Skip to Content
Menú
This question has been flagged
1 Respondre
10489 Vistes

I know It is possible to get a record using self.env['res.partner'].search([]) and creating one using self.env['res.partner'].create({}). But how can I update an existing record? for example update name field of res.partner record.

Avatar
Descartar
Best Answer

Hi,

You can update an existing in the following ways:

partner = self.env['res.partner'].search([], limit=1)
partner.name = 'Odoo'
partner.write({'name': 'odoo'})

To know more about the odoo orm methods, see: Odoo ORM Methods


Thanks

Avatar
Descartar
Autor

Thanks a lot!

Related Posts Respostes Vistes Activitat
0
d’oct. 21
2269
0
d’oct. 20
3803
0
de maig 15
3698
2
de març 25
1432
5
d’oct. 19
9556