Can not override "name" attribute on menu view in Odoo 11?
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.
Try updating the name with the menuitem shortcut:
<menuitem id="hr.menu_hr_root"
name="My new string"
sequence="92" />
Try with the string attribute as well
<menuitem id="hr.menu_hr_root"
string="My new string"
sequence="92" />
A menuitem points to an action and it takes the name from there, so you may have to override the action name (as some users already commented in your question). Just an original example with the action + menu item:
<record model="ir.actions.act_window" id="account_analytic_distribution_action">
<field name="name">Analytic distributions</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.distribution</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="account_analytic_distribution_search"/>
</record>
<menuitem parent="account.menu_analytic_accounting"
id="menu_account_analytic_distribution"
action="account_analytic_distribution_action"
groups="analytic.group_analytic_accounting" />
And to modify the action name:
<record model="ir.actions.act_window" id="account.account_analytic_distribution_action">
<field name="name">New name</field>
</record>
If the problem is just happening with the translations check if this answer is useful. Updating base module used to work in older versions.
As a workaround you can go to the translated items and update the values directly.
This will work
<menuitem id="hr.menu_hr_root" name="your new string" sequence="92" />
And do not forget to add hr in dependency