Change the name of a parent menu in odoo 16 - odoo-16

Change the name of a parent menu in odoo 16
I put this code here because it doesn't work for me. I wanted to clarify that what I want is to change the name of a menu but through code, not through the odoo interface
<record id="hr_payroll.menu_hr_payroll_payslips" model="ir.ui.menu">
<field name="name">New name</field>
</record>
What I'm trying to do is to be able to change the name of a parent menu in odoo 16, but so far the only thing I've managed to do is change the name of a sub-menu. How can I change the name of a parent menu in odoo 16? Could you help me on that part please.
your text`
<record id="menu_hr_payroll_payslips_new" model="ir.ui.menu">
<field name="name">Nómina</field>
<field name="sequence">70</field>
<field name="parent_id"
ref="hr_payroll.menu_hr_payroll_employee_payslips_to_pay"/>
<field name="action" ref="hr_payroll.hr_payslip_action_view_to_pay"/>
</record>
I tried this code and it worked for me but only to change the name of a sub-menu, but what I want is to change the name of a parent menu in odoo16`

Related

How can I add required columns in odoo Many2many form view?

I am having a Many2many field on a form view, field is supposed to show 5 columns but it shows only 3 in my case. All 5 fields are available there on other model. but still not able to get the solution. Help appreciated. I am using Odoo v-10.
Here it shows 3 columns, and I want 5.
Edit its form view and where you defined the field add its view there
<field name="my_many2many_field">
<tree>
<field name="first_field"/>
<field name="second_field"/>
<field name="third_field"/>
<field name="fourth_field"/>
<field name="fifth_field"/>
</tree>
</field>

How to display only my costumes (created ) modules in Odoo (OpenERP)

I would like to show only my custom module in Odoo interface, without displaying other Odoo Modules.
I have tried to assign my module to the user ( in user settings interface) and hidde other modules to him. But when the user login he see only the Web module, without the other modules.
For example:
I Odoo menu you can see the names of modules like : Sales, Calender ...etc
My goal is to hidde all module to users, and display only my module ( my costum module)
Any help please ... Thank you
Inherit action for module list and add a domain
Try below code:
<record id="open_module_tree" model="ir.actions.act_window">
<field name="name">Apps</field>
<field name="res_model">ir.module.module</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('name,'=','your_module_name')]</field>
<field name="context">{'search_default_app':1}</field>
<field name="search_view_id" ref="view_module_filter"/>
<field name="help" type="html">
<p><b>No module found!</b></p>
<p>You should try other search criteria.</p>
</field>
</record>
Hope it will help you.

Hide fields in odoo9 openerp

I want hide fields for user in odoo 9. For example, hide Deadline in Project > Task module.
Only administrator can see this fields.
Any solution how create group etc. hide_only_admin_see and in field add this line.
<field name="date_deadline" groups="hide_only_admin_see" />
I'm find in source groups="base.group_no_one", groups="base.group_user"
but don't understand is it possible create my own group, when add to fiels that only Manager can see this...
Here is my solution:
https://postimg.org/image/rvxi74f51/
https://postimg.org/image/b87h1dlhv/
https://postimg.org/image/5mzst1wtz/
ID from file add to field etc: groups="export.res_groups_84"
On odoo 8, you forbid access to a field to all users (except configuration permissions) in that way:
<field name="date_deadline" position="attributes">
<attribute name="groups">base.group_system</attribute>
</field>
To create new group of permissions,
on odoo 8, you can create record for new category like:
<record model="ir.module.category" id="xxx">
<field name="name">Name of new category of permissions</field>
<field name="sequence">200</field>
</record>
You can create new records for groups permission on res_groups:
<record model="res.groups" id="hide_only_admin_see">
<field name="category_id" ref="XXXX"/>
<field name="name">Usuario</field>
</record>
On category_id you must write the ir_module_category you are creating / overridiing.
After this, you have to create a line on your ir.model.access.csv to give correct permissions to the model you want, something like:
"access_project.issue","project_issue access","model_project_issue","hide_only_admin_see",1,0,0,0
Finally, go to the line and override like:
<field name="date_deadline" groups="your_custom_module.hide_only_admin_see" />

What is the use of ir.ui.menu in OpenERP 7.0?

I am new to OpenERP and I wish to know about that what is model="ir.ui.menu" in OpenERP. Like this there are many other models also there.
For eg:
model="ir.ui.view"
model="ir.actions.act_window"
Can any one explain all this?
With the ir.ui.menu model you can create new menu items. You can use the menuitem tag, it is shortcut:
<record id="menu_human_readable_name" model="ir.ui.menu" >
<field name="name">Human readable name</field>
<field name="sequence" eval="10" />
<field name="action" ref="action_name" />
<field name="parent_id" ref="base.menu_custom" />
</record>
And you have a small explanation of the ir.actions.act_window model in the Odoo documentation. You can assign the id of this kind of action in the field action of the ir.ui.menu model
The most common action type, used to present visualisations of a model
through views: a window action defines a set of view types (and
possibly specific views) for a model (and possibly specific record of
the model).
<record id="action_human_readable_name_act_window" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="name">Human readable name</field>
<field name="res_model">model.name</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
<field name="target">current</field>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="search_view_id" ref="ir.ui.view" />
</record>
The ir.ui.view is used for the views where you show the field or tree list
You have more information in the Odoo Documentation:
Views define the way the records of a model are displayed. Each type
of view represents a mode of visualization (a list of records, a graph
of their aggregation, …). Views can either be requested generically
via their type (e.g. a list of partners) or specifically via their id.
For generic requests, the view with the correct type and the lowest
priority will be used (so the lowest-priority view of each type is the
default view for that type).
<record model="ir.ui.view" id="view_id">
<field name="name">view.name</field>
<field name="model">object_name</field>
<field name="priority" eval="16"/>
<field name="arch" type="xml">
<!-- view content: <form>, <tree>, <graph>, ... -->
[...]
<field name="field_name" />
[...]
</field>
</record>
Menus and Actions
Menus are records in the ir.ui.menu table. In order to create a new menu entry, you can directly create a record using the record tag.
<record id="menu_external_id" model="ir.ui.menu">
<field name="name">New Menu</field>
<field name="action" ref="action_external_id"/>
<field name="sequence" eval="<integer value>" />
<field name="parent_id" ref="parent_menu_external_id"/>
</record>
There is a shortcut by using the menuitem tag that you should use preferentially. It offers a flexible way to easily define the menu entry along with icons and other fields.
<menuitem id="menu_external_id"
name="New Menu"
action="action_external_id"
icon="ICON_NAME"
groups="groupname"
sequence="<integer value>"
parent="parent_menu_external_id"
/>
If you remove parent/parent_id from menu/menuitem then it becames top level menu.
Actions
action specifies the identifier of the attached action defined in the action table (ir.actions.act_window). This field is not mandatory : you can define menu elements without associating actions to them.
This is useful when defining custom icons for menu elements that will act as folders. This is how custom icons for “Projects” or “Human Resources” in OpenERP are defined).
The actions define the behavior of the system in response to the actions of the users ; login of a new user, double-click on an invoice, click on the action button, ...
There are different types of simple actions:
Window: Opening of a new window
Report: The printing of a report
- Custom Report: The personalized reports
- RML Report: The XSL:RML reports
Execute: The execution of a method on the server side
Group: Gather some actions in one group
The actions are used for the following events:
User connection.
The user clicks on a menu.
The user clicks on the icon ‘print’ or ‘action’.
<record id="action_external_id" model="ir.actions.act_window">
<field name="name">action.name</field>
<field name="view_id" ref="view_external_id" />
<field name="domain">[('field','operator','value')]</field>
<field name="context">{'key':value}</field>
<field name="res_model">Model Name</field>
<field name="view_type">form|tree</field>
<field name="view_mode">form,tree|tree,form|form|tree</field>
<field name="target">new/current</field>
</record>
I hope you will easily understand my explanation below:
"ir.ui.menu" is a model which is mapped as ir_ui_menu table of database that stores data of menus in Odoo (OpenERP). Every menu in Odoo (OpenERP) is inserted via xml file and stored in database. Also, "ir.ui.view" stores view data (such as form, tree, and search views) and "ir.actions.act_window" stores action data.
Conclusion: Mostly (not all), models inside OpenERP are manifestation of tables inside database.
http://useopenerp.com/v8/model/ir-ui-view#pagetop
https://www.odoo.com/documentation/8.0/reference/actions.html#window-actions-ir-actions-act-window
See the above references for detail.
hope this will help you.

Openerp remove a submenu

I want to hide/remove "Timesheet Activities" from the "Human Resource" module. I thought assigning it to a different group would do the trick but it doesn't seem to work.
This is what I have in my custom security.xml:
<record id="timesheet_activities" model="res.groups">
<field name="name">Timesheet Activities</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
You need to add group on menu Timesheet Activities
Go to Setting => Technical => User Interface => Menu items => and find out "Timesheet Activities" add it with new group created.
Create new group and add only Administrator to this group and assign that group to the any menus. So the only admin can see the menus for all other it will be hidden.
If you want to do it from backend then just overwrite the menu in your custom module and add the new group in that menu section
Create a group named like Hidden Items,
<record model="res.groups" id="group_invisible">
<field name="name">Hidden items</field>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
And add that menu into this group,
<record id="module_name.menuitem_name" model="ir.ui.menu">
<field name="groups_id" eval="[(6, False, [ref('module_name.group_invisible')])]"/>
</record>
Hope it will resolve your problem.
<delete model="ir.ui.menu" id="hr.your_menu_id"/>