Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Developing module, setting security

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
1 Responder
9051 Vistas
Avatar
Roberto Cocchiararo

Hi

I recently switched from using the web ui to module programing for a module i am making for extending the stock fleet management module (i had to, because with web ui, i had no way to make bidirectional many2many fields, nor set the "name" field of one of my custom models to be computed (concatenating the info from other 3 required fields), which i needed for displaying in a many2one selection field.)

I added 2 models of my own and extended the vehicle model. I also added views/menues/actions for my models, and replaced the stock vehicle views with my extended ones.

I have now to add security to my models/views/menues/actions, and even after reading the documentation and trying, i don't understand how it works.

Since i knew nothing on this matter, i learned with the v8.0 documentation, but the security part is not enough for me to learn it it seems:

https://www.odoo.com/documentation/8.0/howtos/backend.html#security

I don't need to add new groups, since i am extending the ones from the fleet menu:

group_fleet_manager

group_fleet_user

The first group should have full access to my added stuff, and the 2nd one should have read/creation access. (my new models are "events" and "fleet insurance", and both have their menu item for accessing their tree/form views).

Any tips in the right direction? I looked at the security files in the fleet module (one xml, one csv), and i can't grasp the naming in anything in the csv file before the GROUP (which i mentioned above) and the 1 or 0 for enabling or disabling permissions.

In the XML where i defined the menu/actions, i specified the group_fleet_manager, but that seems to do nothing (And i want to give read access at least for users).

0
Avatar
Descartar
Roberto Cocchiararo
Autor

Hi again. I thought i had this after those explanations, but i don't T_T. I made a module that extends some models/objects in the fleet module. (i had previously done that in the web UI). Then, i wanted to add the 2 groups i manually made (by copying the 2 groups in the fleet module, and removing the unwanted menu items). For that, i copied the 2 security files from the fleet module, and replaced in them the group names with my own ones. I also had to add fleet. in some places, because if i did not, ODOO would thing i was working with some mymodule. stuff. When i try to install, i get: #"Exception: Module loading vehiculospc failed: file vehiculospc/security/ir.model.access.csv could not be processed: Line 1 : No matching record found for external id 'model_fleet_vehicle_model' in field 'Object'"#

Avatar
Ivan
Mejor respuesta

Roberto, security in Odoo is controlled through 3 mechanism, AFAIK:

  • For each model, you can specify the ACL (Settings >> Technical >> Security >> Access Control List).  You can make this specific for a group, or for Public (if you don't specify any group).  The ACL specify whether the group (or everyone if it is Public) have Create, Write, Update, and Delete access to the model.  Note that if you don't specify any ACL, then only Super Admin have access to your model.  In modules, usually this is specified and loaded as csv file.  Check the odoo/addons/account/security/ir.model.access.csv file for samples.  In fact the name of the file must be exactly that (ir.model.access.csv).
  • For each model, you can specify Record Rules (Settings >> Technical >> Security >> Record Rules).  Here you can futher tune the types of records that a group (or Public if you don't specify any group) have access to.  The rule is specified in the domain form.  You can check odoo/addons/account/security/account_security.xml for samples.
  • For each view, you can futher control access to widgets by way of groups attribute.  This groups attribute can contain a list of groups XML IDs that can view that widgets when the form is displayed.  odoo/odoo/addons/account/account_bank_view.xml have samples for this.

 

1
Avatar
Descartar
Roberto Cocchiararo
Autor

I am trying to use the first method, but from the samples (i looked at the fleet module one, since that one i know how to use and i wanted to emulate it's way of doing it), i was unable to fully understand it. The "columns" in .csv file are: "id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink". I believe "id" and "name" have to be made up by me. Then "model_id:id" confuses me, because i do not find a correlation to the models with that, it also seems "made up", but if that is so, how does it work? "group_id:id" is the group.

Ivan

model_id:id will be in the in the format of model_XXXX where XXXX is the model's name with all the dots converted to underscore. e.g. sale.order -> model_sale_order. This is the XML ID of the model, which will be created automatically. group_id:id is the group. You also need to supply the XML ID of these groups. If this field is empty, it will became a public ACL. Usually when you create a group, you use in XML file. YYYY is the XML ID. If you want to find out the XML ID of a particular object, there are 2 paths that you can choose. First path is activate developer's mode, go the the object's Form View and select the View Log from the Combo Box on the top left of the view. Second path is to search it through Settings >> Technical >> Sequences & Identifiers >> External Identifiers and search for that particular model and ID. perm_XXX need to be boolean (1 or 0) for read, write, create, and delete (unlink) respectively.

Marvin Taboada

Hello Roberto, John. I posted an answer in another question where I elaborate about External IDs. There I explain why we have to use 'model_XXXX' or even 'module_name.model_XXXX' in a similar context (references to 'ir.model' records). Feel free to take a look here: https://www.odoo.com/forum/help-1/question/what-does-field-name-model-id-ref-xxxx-refer-to-68794

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now