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

how does it worked controller in odoo 17

Suscribirse

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

Se marcó esta pregunta
mvcodoo
2 Respuestas
3854 Vistas
Avatar
admin

when i perform any action in odoo then in backened which addons file is used and which method and which view code is execute.

  

when i click on new button on project module then in backened which controller is worked , which method is execute.

0
Avatar
Descartar
Avatar
Sujata
Mejor respuesta

Hello,

When you perform an action in Odoo, like clicking the New button in the Project module, Odoo triggers a flow involving the frontend (views) and backend (methods).

Frontend: Views and Actions

When you click the button, Odoo checks the view (form or list) that you're interacting with. In this case, the New button usually opens a form view to create a new project. You can use Developer Mode to inspect the view and understand which action is being triggered.

Backend: Methods and Models

Once the button is clicked, Odoo calls a method in the backend. For example, the New button typically triggers the create method in the project.project model. This method is responsible for creating a new record and can be found in the models file at addons/project/models/project.py.

Controller (If Applicable)

If you're working with frontend-related features, a controller might be involved. Controllers handle web-based actions and are located in the controllers/ folder. However, for basic backend actions like creating a project, controllers are usually not involved.

How to Trace What's Happening
  • Use Developer Mode: You can track which view and action are triggered when performing any task.
  • Check Logs: Odoo logs (e.g., odoo.log) will show which methods are executed, giving you insights into the backend flow.
  • Branching and Conditional Logic: Sometimes, methods in the backend handle multiple conditions depending on user inputs or system state, which you can also trace through developer tools.

----------------------------------------------------------------------------------------------------

It’s understandable that the role of controllers in Odoo's MVC (Model-View-Controller) structure can be confusing, as Odoo doesn't always follow the traditional MVC pattern, especially when it comes to backend operations. Let me clarify this for you.

Odoo's MVC Structure:
  1. Model (M):
    • This represents the data layer in Odoo. It deals with creating, updating, deleting records (like creating projects, adding tasks, etc.). Models are defined in the models folder and interact with the database.
    • Example: The project.project and project.task models manage the logic for creating and manipulating projects and tasks.
  2. View (V):
    • Views in Odoo define how data is presented to the user. They are usually form views, tree views, kanban views, etc., and are defined in XML files. This is how Odoo allows users to interact with models.
    • Example: When you open a project form or task view, you are interacting with Odoo views.
  3. Controller (C):
    • In Odoo, controllers are primarily used for handling web requests, API calls, and frontend operations (e.g., website, eCommerce). Controllers handle HTTP requests and usually reside in the controllers folder.
    • In the backend, when you perform operations like creating projects, adding or deleting tasks, controllers are generally not involved. These actions are managed directly by the models and triggered by views (through actions, buttons, etc.).
    • Controllers are involved when dealing with web requests, such as in the website module or REST API calls, but not for regular backend data manipulation (e.g., project and task management).
How it Works in Your Case (Projects and Tasks in Backend):
  • Creating a project or task in the backend directly interacts with the model (project.project or project.task), which processes the data and stores it in the database.
  • Deleting a task is handled in a similar way by the model's unlink method.
  • No controller is involved because you are not dealing with a web request. Instead, the model handles all the business logic and database operations.
When Are Controllers Used?
  • Frontend Operations: For handling web page interactions or requests from users via the website or portal (e.g., submitting forms on a website).
  • REST API: When exposing API endpoints or custom routes that interact with the Odoo backend.
  • Web Clients: If your app requires custom logic that needs to be triggered via HTTP requests, then you would define a controller.
Example of Odoo Project App Flow:
  • Create Project: You create a project from the form view. The request goes through the view and interacts directly with the project.project model.
  • Add Tasks: When you add tasks, the action is processed directly by the project.task model.
  • Delete Tasks: Deleting tasks uses the model’s unlink method, and no controller is involved unless it's a frontend request.

Let me know, if it helps :)

2
Avatar
Descartar
Avatar
admin
Autor Mejor respuesta

Hi, Thank you for the reply. I got some inputs. When I studied online about how MVC working in Odoo, I am getting different answers and little bit confused. Specifically about controllers. For example, 

In the back end, I am creating projects, adding tasks and deleting one or two tasks. In this case also controllers not involved ? Please clarify. For example, The models folder is not included any code related controller according to Odoo MVC ? for Project App

0
Avatar
Descartar
Sujata

Hello, please refer to my answer again. I have added an explanation of how the MVC structure works with reference to your question after the separator.

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

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
How does the Controller part of MVC concepts applies to Odoo?
mvc odoo
Avatar
Avatar
1
oct 15
5164
Odoo Studio Many2one field not appearing in automations
odoo
Avatar
Avatar
1
dic 25
321
SOC 1 Report
odoo
Avatar
Avatar
2
nov 25
427
邮箱无法正常使用
odoo
Avatar
Avatar
1
nov 25
2359
How do I go about this error? I am trying to uninstall a module
odoo
Avatar
Avatar
1
nov 25
3617
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