Odoo Help

Welcome!

This community 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.

0

How can I update a record stored with the attribute noupdate="1"?

By
Robin Chatfield
on 2/27/15, 3:46 AM 1,616 views

I have a module that got the noupdate="1" attribute added to all views, actions and menuitems. Now those records can't be upgraded, even after the xml file in the module has been corrected. I'm already using the module, and would rather not have to reinstall it and lose the data.

Some options I've considered:

Find where the noupdate attribute is stored in the database, and change it for my records. Does anyone know how this can be done?

Delete all the records from the database. Tried it, and it works. Unfortunately the db crashes before I've goten all the records, and then I have to restore and am back to square one.

Export the data, uninstall module, reinstall, and import the data again.

Do you want to improve those views?

Mansi Kariya (mka)
on 2/27/15, 3:50 AM
1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 2/27/15, 4:51 AM

The noupdate is stored in the ir_model_data table.  Just change the noupdate column to FALSE for the record (search it using the XML ID against the name column).  This will allow you to make "noupdate" records to be updateable in the future.

If you want to just change something in the records created by the data XML, I would recommend that you just change it via the application, e.g. for ir.ui.view --> through Settings >> Technical >> User Interface >> Views.

1
Habib
On 4/5/16, 6:17 PM

Records that are created in xml files also create an external identifier which is named [module name].[id]

When noupdate="1" is specified in the xml data file, then the external identifier created has a field called noupdate set to True. Once this happens, it is impossible to update a record using xml.

You can find the external identifier in Technical -> Sequences and Identifiers -> External Identifiers. Find the id of the record you're looking for and uncheck the noupdate field. Once this is done, you can update the record using your xml data file.

I had a requirement for a module to update existing records which were previously set to noupdate. This had to be done in xml. To achieve this I did the following in the data file (new_module_data.xml)

1.I deleted the record

2. I re-created the record using the original identifier

<openerp>
<data noupdate="0">
<delete id="old_module_name.identifier" model="old_module_name.model"/>
<record id="old_module_name.identifier" model="old_module_name.model">
...
</record>
</data>
</openerp>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/27/15, 3:46 AM
Seen: 1616 times
Last updated: 4/5/16, 6:17 PM