problem when I add permission to my model - odoo

Add the security to grant permissions to my groups, but when updating odoo I do not see the module installed and when entering with other users the system does not show me anything
security.xml
<record id="grupo_administrador" model="res.groups">
<field name="name">Administrador</field>
</record>
<record id="grupo_profesor" model="res.groups">
<field name="name">Profesor</field>
</record>
<record id="grupo_instructor" model="res.groups">
<field name="name">Instructor</field>
</record>
ir.model.access.csv
access_administrador_profesor,gimnasio.profesor,model_gimnasio_profesor,gimnasio.grupo_administrador,1,1,1,1
access_administrador_alumno,gimnasio.alumno,model_gimnasio_alumno,gimnasio.grupo_administrador,1,1,1,1
access_administrador_plan,gimnasio.plan,model_gimnasio_plan,gimnasio.grupo_administrador,1,1,1,1
access_administrador_reserva,gimnasio.reserva,model_gimnasio_reserva,gimnasio.grupo_administrador,1,1,1,1
access_administrador_clase,gimnasio.clase,model_gimnasio_clase,gimnasio.grupo_administrador,1,1,1,1
access_profesor_rutina,gimnasio.rutina,model_gimnasio_rutina,gimnasio.grupo_profesor,1,1,1,1
access_profesor_ejercicio,gimnasio.ejercicio,model_gimnasio_ejercicio,gimnasio.grupo_profesor,1,1,1,1
access_profesor_evaluacion,gimnasio.evaluacion,model_gimnasio_evaluacion,gimnasio.grupo_profesor,1,1,1,1
access_profesor_progreso,gimnasio.progreso,model_gimnasio_progreso,gimnasio.grupo_profesor,1,1,1,1
access_profesor_reserva,gimnasio.reserva,model_gimnasio_reserva,gimnasio.grupo_profesor,1,1,1,1
access_profesor_alumno,gimnasio.alumno,model_gimnasio_alumno,gimnasio.grupo_profesor,1,1,1,1
access_profesor_plan,gimnasio.plan,model_gimnasio_plan,gimnasio.grupo_profesor,1,1,0,0
access_instructor_reserva,gimnasio.reserva,model_gimnasio_reserva,gimnasio.grupo_instructor,1,1,0,0
access_instructor_clase,gimnasio.clase,model_gimnasio_clase,gimnasio.grupo_instructor,1,1,0,0

Related

Permission to a group on button click in odoo 14

i have create a group in security.xml as
<record id="group_requester" model="res.groups">
<field name="name">Requester</field>
<field name="category_id" ref="IT_asset_module.module_category_it_assets"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
</record>
and in view.xml as
<button name="action_submit" states="draft" string="Submit" type="object" class="oe_highlight" groups="IT_asset_module.group_requester"/>
But when i click on button following error occur;
You are not allowed to access 'System Parameter' (ir.config_parameter) records.
This operation is allowed for the following groups:
- Administration/Settings
Contact your administrator to request access if necessary.
I do not want to give Administration/Settings access to user.
Please guide.
change implied_ids to:
<field name="implied_ids" eval="[(4, ref('base.group_system'))]"/>
or add your group in model ir.config_parameter inside your module security/ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ir_config_parameter_requester,config_parameter_requester,base.model_ir_config_parameter,IT_asset_module.group_requester,1,1,1,1

How to remove implied ids from group in odoo?

I am trying to remove implied ids of purchase user group.
This is actual group in purchase order
<record id="group_purchase_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="base.module_category_purchase_management"/>
<field name="implied_ids" eval="[(4, ref('group_purchase_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
Then I am trying to remove implied of the group in my custom module
<record id="purchase.group_purchase_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="base.module_category_purchase_management"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
I also tries another
<record id="purchase.group_purchase_manager" model="res.groups">
<field name="implied_ids" eval="False"/>
</record>
unfortunately both will not work.
I checked the groups of purchases/Manger in UI but the inherited group purchases/User still there.
How to remove implied ids from purchase manager group??
You may try with following code.
<record id="purchase.group_purchase_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="base.module_category_purchase_management"/>
<field name="implied_ids" eval="[(4, ref('purchase.group_purchase_user'))]"/>
<field name="users" eval="[(3, ref('base.user_root'))]"/>
</record>
With help of 3, we will cut/delete relationship between two objects without delete target ID (ref('base.user_root')).
I haven't tested it.

how to set access rights of group-mananger and group-user on single view and action in odoo

I am working access rights in odoo so trying to apply manager and user access rights on same view and action. is it possible to apply access rights on same (view) which belongs to both group-manager and group-user but having access right different?
You can give view/action access rites to more then one group.
<record id="view_order_form_editable_list" model="ir.ui.view">
<field name="name">sale.order.form.editable.list</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="groups_id" eval="[(4, ref('product.group_uos')), (4, ref('product.group_stock_packaging')), (4, ref('sale.group_mrp_properties'))]"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='order_line']/tree" position="attributes">
<attribute name="editable"/>
</xpath>
</field>
</record>
You can give any number of group in group_id tab

Odoo - how to make mutually exclusive user groups

When you go to configuration->users in odoo as administrator, you see two groups under the category administration: Settings and Access rights. Since one of these groups are selected from a combo box, it seems to me like these groups are mutually exclusive, that is that a user can't be a member of both groups.
I need to do exactly the same with two groups under a custom category which I have created with the following data file:
<record id="FVO" model="ir.module.category">
<field name="name"> FVO </field>
</record>
<record id="FVO_nuova" model="res.groups">
<field name="name">FVO - nuova vista</field>
<field name="category_id" ref="FVO"/>
</record>
<record id="FVO_vecchia" model="res.groups">
<field name="name">FVO - vecchia vista</field>
<field name="category_id" ref="FVO"/>
</record>
But in the users form, they appear as two check boxes, which means that the user could be member of both groups.
Now I've studied both of these groups, and it's category, inspecting also the tables in which they are stored, to try to find out which flag they have so that Settings and Access rights can't be applied to one user at the same time, but for the life of me, I can't find anything special nor in the record for the group, nor in the record for the category.
Is someone able to point out what I'm missing?
I don't know the meaning of vecchia vista and nuova vista so i cannot understand if they are cascade or not, if they are cascade (inherited) rights (like 'see_own_leads' and 'see_all_leads'), you should use
<field name="implied_ids" eval="[(4, ref('FVO_nuova'))]"/> in your FVO_vecchia group so odoo will understand the user should select one of your groups not both of them.
If your groups are not meant to be cascade, i should define 3 groups like this:
`
<record id="FVO_none" model="res.groups">
<field name="name">FVO - no access</field>
<field name="category_id" ref="FVO"/>
</record>
<record id="FVO_nuova" model="res.groups">
<field name="name">FVO - nuova vista</field>
<field name="implied_ids" eval="[(4, ref('FVO_none'))]"/>
<field name="category_id" ref="FVO"/>
</record>
<record id="FVO_vecchia" model="res.groups">
<field name="name">FVO - vecchia vista</field>
<field name="implied_ids" eval="[(4, ref('FVO_none'))]"/>
<field name="category_id" ref="FVO"/>
</record>
`

Creating a new group

I've made a custom module for the warehouse and now I want this module to be available to a new group.
This new group needs to inherit from the stock manager, so it has to have all the rights the stock manager has + access to this new module.
In my xml I defined:
<record id="group_stock_manager_editor" model="res.groups">
<field name="name">Manager Editor</field>
<field name="category_id" ref="base.module_category_warehouse_management"/>
<field name="implied_ids" eval="[(4, ref('group_stock_manager')), (4, ref('account.group_account_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
But this doesn't seem to work, how can I achieve this?
Solved it, the problem was that I wanted to inherit the rights from the group_stock_manager from a custom module, so instead of group_stock_manager it had to be stock.group_stock_manager