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

vITraining Admin

Question:

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.

Does anyone know how this can be done?


Solution:

Example to modify Sale Order Sequence, which is installed with noupdate="1" attribute:


<odoo>	
<data>
  <function name="write" model="ir.model.data">
<!-- First we need to find the record...-->
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'sale'), ('name', '=', 'seq_sale_order')]"/>  
</function>

      <!-- ...and temporarily set the noupdate field to False-->
<value eval="{'noupdate': False}" />
</function>

  <!-- Get our main job done, i.e. modify the domain_force field of a record -->
 <record id="sale.seq_sale_order" model="ir.sequence">
<field name="prefix">SSO-%(year)s-%(month)s-</field>
</record>

  <!-- (Optional) Time to clean our dirty hand, set the previously noupdate False to True again -->
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'sale'), ('name', '=', 'seq_sale_order')]"/>
</function>
<value eval="{'noupdate': True}" />
</function>
</data>
</odoo>