Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
10588 Prikazi

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
Opusti
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
Opusti
Avtor

Thanks a lot!

Related Posts Odgovori Prikazi Aktivnost
0
okt. 21
2349
0
okt. 20
3993
0
maj 15
3843
2
mar. 25
1729
5
okt. 19
9764