Odoo Help


why does orm load() method mark external ids as noupdate=False by default ?

HIGHCO - Nicolas Clavier
on 6/21/13, 8:20 AM 2,327 views

In the process of loading big amount of data into tables, I noticed that when restarting the server updating my custom module, the data previously entered was deleted from the database automatically !

I use the load() method and for each record I specified an xml_id (external id) so that running the same import twice would only update records. When looking at the the external ids created, I noticed that the noupdate field was automatically set to False.

Those records are therefore deleted when updating the module, as part of the module update protocol.

Can anyone help on how to intruct the load() method to forcecreate / set no update = True on the xml_ids of my newly created records ?

Doc reference:


As a temporary workaround I added the following to my import function: From the ids returned by the load() method, I search for corresponding ir_model_data entries, and update their 'noupdate' field to True.

res = partner_pool.load(cr, uid, field_names, partners, context=context)

if res['ids']:
    imd_pool = self.pool.get('ir.model.data')
    imd_ids  = imd_pool.search(cr, uid, [('res_id','in',res['ids']),('model','=','res.partner')], context=context)
    _logger.debug("Fixing external ids with no update = True on : %s" % imd_ids)
    if imd_ids:
        imd_pool.write(cr, uid, imd_ids, {'noupdate':True}, context=context)

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/21/13, 8:20 AM
Seen: 2327 times
Last updated: 3/16/15, 8:10 AM