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.
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.
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
<delete id="old_module_name.identifier" model="old_module_name.model"/>
<record id="old_module_name.identifier" model="old_module_name.model">
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
|Asked: 2/27/15, 3:46 AM|
|Seen: 1616 times|
|Last updated: 4/5/16, 6:17 PM|