Comment 5 for bug 580218

Revision history for this message
JMA(Open ERP) (jma-openerp) wrote : Re: trunk - ir.actions.act_window - context must be at least {}

Hello guys,
I would like to interrupt here.

Here,there are 2 aspects coming into picture:
1. Updation of XML file
2. Database values.

 While updating an xml file, it will only consider the tags available and it will update them.
Example:
<record id="act_values_form_action" model="ir.actions.act_window">
            <field name="name">Connect Actions To Client Events</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">ir.values</field>
            <field name="view_type">form</field>
            <field name="view_mode">form,tree</field>
            <field name="context">{''democracy" : False}</field>
        </record>

Is the main record in xml. Now if I change the value of field context to anything like {'Barack':'Obama''}, context will be updated in DB for this record as context is available in the xml record.
If I delete the record, on updatin of xml file, server won't find the context key and simply,won't update the field in database.

If you want to remove the XML record, you may use delete tag :
<delete model="ir.actions.act_window" search="[('name','=','act_values_form_action')]"/>

If I only want to remove a value of any field, I should set default value like
<field name="context">{}</field>.

If I am using a module which uses the record and want to edit the record, I would use:
<record id="MODULENAME.act_values_form_action" model="ir.actions.act_window">
            <field name="name">MODIFIED HEADER</field>
            <field name="context">{'Are you a new context': 'Yes'}</field>
        </record>

Hope this helps.
Thanks.