Odoo Help


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.


Renaming an ir.actions.act_window.view record

Pierre Beghin
on 4/1/15, 8:42 AM 1,040 views


I'm currently refactoring a custom module and need to alter some ids of misnammed records.

If I can easily do this for the ir.ui.view models, I get an error each time I try to change id of ir.actions.act_window.view record.

Here is the record, very simple:

<record id="b_action_notificationtree" model="ir.actions.act_window.view">
     <field name="sequence" eval="1"/>
     <field name="view_mode">tree</field>
     <field name="view_id" ref="view_notification_tree"/>
     <field name="act_window_id" ref="b_action_notifications"/>

I would like to rename 'b_action_notificationtree' in 'b_action_notification_tree' or anything else.

When I do this, this is the error I get: 

IntegrityError: duplicate key value violates unique constraint "act_window_view_unique_mode_per_action"
DETAIL: Key (act_window_id, view_mode)=(618, tree) already exists.

I know I cannot have multiple tree views for a single record, but here I don't want to create a new one, just update its id.

So, there are 2 questions I would like to get assistance for:

- Where does this 618 comes from ? It looks like a self generated unique key associated to the record

- How can I rename an existing id ?

Thank you very much for helping me on this one.


Pierre Beghin
On 4/1/15, 9:52 AM

Well, I found an answer for the 1st question and solution for the main problem.

the 618 integer value is the id of the ir.actions.act_window associated to my ir.actions.act_window.view record. It is stored in the 'ir_act_window' table. On the other side, my ir.actions.act_window.view record is stored in the table ir_act_window_view and refers to the associated  ir.actions.act_window in the 'act_window_id' field. Those id values are not defined forever, and will change if updates are committed to the view and the module is reloaded.

The name of the record (in my case 'b_action_notificationtree') is stored in the 'ir_model_data' table and refers to the model with the 'res_id' field.

The funny thing here is that modifying this name is not allowed (I guess because there is no way of retrieving the previous name to select the right record for an update)

The solution (at least the one I found and that works) appears to comment the full record requiring modifications of the id, reload the module, uncomment the record with a modified id and reload the module again.

Hopes it can help someone.



PS: thanks to Temur. I answered at the same time. Unfortunately, I have not enough karma to comment on your comment !!



| 6 4 7
Tbilisi, Georgia
On 4/1/15, 9:35 AM

618 is database id of the record, as these records are saved in database

you can try to use different xml id here: id="b_action_notificationtree"  (probably you've already used this id somewhere, or old record with this id still persists in database by accident) 

I think you can install the module in new database without problem, as old record will not present there.

on 4/1/15, 9:39 AM

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)


Asked: 4/1/15, 8:42 AM
Seen: 1040 times
Last updated: 4/1/15, 10:00 AM