Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

How Odoo 13 store the constraints of a custom model? 

Suscribirse

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

Se marcó esta pregunta
apiconstraintbasemodelOdoo13
2 Respuestas
2602 Vistas
Avatar
Mahdi Berranem

I was doing research to understand how Odoo 13 works, and I want to add a customized field type like Title, short text, or long text and I want to map them to Odoo 13 as Odoo fields with additional constraints, so the question is:

1- How Odoo 13 store the constraint (func) of a custom model and link them with a specific model? 

For me, I want to create a transition layer to create my customized types in the Odoo world.

Thank you all for helping me ! 

0
Avatar
Descartar
Avatar
Mahdi Berranem
Autor Mejor respuesta

@Axel Mendoza Thank you for helping me

I noticed that Odoo 13 has a feature that gives you the ability to create models & fields from the UI, my Idea is to build a feature like this one, but with bespoke field type, for example, a new field type "Title" which the user can type max of 50 characters or other customized constraints, so when I create a field with this type it should generate a new constraint to validate it, I already mapped the model and the basic fields with Odoo, in this stage I need to know how Odoo stores the constraints so I can do the same.

note: I can't do Python constraint because the model is created from the UI so I don't have a Python class or a code file

Any Ideas are welcome!


0
Avatar
Descartar
Axel Mendoza

So you are talking about sql constraints but not all of them are exactly constraints meaning that the length of a field it's part of it's definition like `character varying(64)`

Mahdi Berranem
Autor

SQL constraints are not customized and it's stored in the database so if I want to add an a SQL constraints, I can use query like <<ALTER TABLE orders ADD CONSTRAINT check_revenue_positive CHECK (revenue >= 0);>> (I can't use sql_constrain[] because I don't have a python class or a code file), I want to find a way to replace @api.constraint() without actually code it, my idea was knowing how Odoo stores the python constraints so I can do same, so I can auto generate customized constraints and store it where Odoo stores python constraints so Odoo can take my constraints into consideration and run it like it is written in the file class

Avatar
Axel Mendoza
Mejor respuesta

It's not very clear for me what you wanna do with your transition layer to create my customized types in the Odoo world.​

But there are 2 types of constraints in Odoo.

  1.  SQL constraints: https://www.odoo.com/documentation/16.0/developer/tutorials/getting_started/11_constraints.html#sql
  2. Python constraints: https://www.odoo.com/documentation/16.0/developer/tutorials/getting_started/11_constraints.html#python

If you dynamically generate your custom models constraints into an Odoo module like if you have manually create it and Install it you could get whatever you want to do integrated completely with Odoo. 

If you are looking for a way to save the python constraints as data in order to execute it, I think you will need to also create that by yourself


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

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Get The Access Type in Odoo Model Constraint Resuelto
api constraint
Avatar
Avatar
Avatar
2
jul 17
4181
[v9]How to set up a constraint for the full record
api constraint
Avatar
0
abr 16
4044
Odoo13 Create Invoice via API/xmlrpc
invoice api xmlrpc account.move Odoo13
Avatar
0
may 20
5173
How do I get Product Prices with json API? Resuelto
api
Avatar
Avatar
1
nov 25
2834
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Avatar
Avatar
1
ago 25
1395
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 totalmente integrado.

Website made with

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