CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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_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.
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 !!
About This Community
Odoo Training Center
|Asked: 4/1/15, 8:42 AM|
|Seen: 1744 times|
|Last updated: 4/1/15, 10:00 AM|