Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not override "name" attribute on menu view in Odoo 11?

Tags:

xml

odoo

odoo-11

I'm new to Odoo. I would like to change the top most menu name (with no action) from Employee to My new string.

<record id="hr.menu_hr_root" model="ir.ui.menu">
    <field name="name">My new string</field>
    <field name="sequence">92</field>
</record>

I'm sure that id is correct because sequence attribute is changed as expected. The problem is the name being unchanged anyway. The menu I want to modify is from default hr module. The only solution I have for now is to delete the record and recreate it with the new values. I tried to update on my own other menu views and they work as I expected, but the case from default hr module which is translated into my language (Vietnamese). Could anyone tell me some ideas about this?

like image 601
user123 Avatar asked Jan 27 '19 10:01

user123


1 Answers

I known the problem and resolved by myself. The problem is that any translable strings always is overrided upon translation. The code in my question works in the default language (English). After translation (on installing or setting preferences), the new "name" field doesn't work anymore (other fields are still work).

There are 2 solutions possible:

1) As I said in question, delete the record by id then redeclare the record (copy the code in the original module into the new one). The problem with the solution is the unnecessary duplication code.

2) Export a .po file (translator file) of the module and modify it as intended. Then insert the file into module’s subfolder i18n with the same path and name as the original module. Finally, run the odoo server with --i18n-overwrite flag to override the same file in the original module.

like image 177
user123 Avatar answered Oct 29 '22 09:10

user123