Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

how does it worked controller in odoo 17

Odebírat

Get notified when there's activity on this post

This question has been flagged
mvcodoo
2 Odpovědi
3866 Zobrazení
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
Zrušit
Avatar
Sujata
Nejlepší odpověď

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
Zrušit
Avatar
admin
Autor Nejlepší odpověď

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
Zrušit
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.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
How does the Controller part of MVC concepts applies to Odoo?
mvc odoo
Avatar
Avatar
1
říj 15
5166
Odoo Studio Many2one field not appearing in automations
odoo
Avatar
Avatar
1
pro 25
337
SOC 1 Report
odoo
Avatar
Avatar
2
lis 25
431
邮箱无法正常使用
odoo
Avatar
Avatar
1
lis 25
2364
How do I go about this error? I am trying to uninstall a module
odoo
Avatar
Avatar
1
lis 25
3618
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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