SlideShare une entreprise Scribd logo
1  sur  16
Computed Field`s & @api
Depends on Odoo 15
www.cybrosys.com
INTRODUCTION
A computed field is declared just like any other regular field in Odoo along with the additional
argument compute. The value is the name of the function as a string or a function. In this video,
we are going to learn about computing fields, how it works, and @api.depends on Odoo 15.
❖ Let’s go to custom module ‘Travel Management’, At here we can define another field Such as
‘Total Amount’ which is a product of ‘No. of Days’ and ‘Amount Per Day’, That can be declared
using compute function.
❖ So, at the pycharm, Let’s define that field, here i am defining it as ‘Total Amount’ as an
‘Integer’ field. First step in the compute function is that, we need to define that compute
function along with the field. That is, ‘compute=’_compute_amount’’. Here The
‘_compute_amount’ is the function name.
❖ Then we have to return the function, So first thing we need to add is ‘@api.depends’, for that
we need to import ‘api’ from odoo, ‘@api.depends’ is an ‘api’ operation it depends on some
other field of same table or some other table. Which means our ‘total_amount’ is depend upon
the ‘no_of_days’ and ‘amount_per_day’. So in the ‘@api.depends’ operation we can add those
two fields.
❖ Here one of the field get changed it will depend upon the ‘total_amount’ that we are going to
compute.And let’s define our compute function like below,
❖ So, This function_name we declared in the field ‘total_amount’.
❖ Then we can loop through each records.
❖ Here add a loop for this function. That is, if ‘no_of_days’ is available.
❖ Then Let’s define the amount. That is, the product of ‘rec.no_of_days’ and
‘rec.amount_per_day’ is stored in the field ‘rec.total_amount’.
❖ Instead of the else condition setting it as ‘rec.total_amount’ is false. This means if there is no
‘no_of_days’ is given.
❖ Now, We have to add the ‘total_amount’ field in the xml also,
❖ After Upgrading the module, Let’s check the field in the ‘travel.travel’ model. Here you can
see the Field ‘total_amount’
❖ Here, Let’s see the field ‘total_amount’, which is the product of ‘no_of_days’ and
‘amount_per_day’. Likewise The compute function works.
For More
Details
Check our company website for related blogs and Odoo
book.
Odoo Book V15
Check our YouTube channel for functional and technical
videos in Odoo.
Computed Fields and @api Depends on Odoo 15
Thank You

Contenu connexe

Tendances

scaffold method odoo 16
scaffold method odoo 16scaffold method odoo 16
scaffold method odoo 16Celine George
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical MementoOdoo
 
Owl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOwl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOdoo
 
The Odoo JS Framework
The Odoo JS FrameworkThe Odoo JS Framework
The Odoo JS FrameworkOdoo
 
Rapport jeu en JAVA
Rapport jeu en JAVARapport jeu en JAVA
Rapport jeu en JAVAAhmed WAFDI
 
Configuring Route and Rule in Odoo 15
Configuring Route and Rule in Odoo 15Configuring Route and Rule in Odoo 15
Configuring Route and Rule in Odoo 15Celine George
 
Lot or Serial Number Configuration in Odoo 15
Lot or Serial Number Configuration in Odoo 15Lot or Serial Number Configuration in Odoo 15
Lot or Serial Number Configuration in Odoo 15Celine George
 
How to update currency exchange rates automatically in Odoo
How to update currency exchange rates automatically in OdooHow to update currency exchange rates automatically in Odoo
How to update currency exchange rates automatically in OdooCeline George
 
Odoo 15 Composition of Module
Odoo 15 Composition of ModuleOdoo 15 Composition of Module
Odoo 15 Composition of ModuleCeline George
 
Defining Gantt View in Odoo 15
Defining Gantt View in Odoo 15Defining Gantt View in Odoo 15
Defining Gantt View in Odoo 15Celine George
 
Defining Kanban View in Odoo15 | Advanced Views
Defining Kanban View in Odoo15 | Advanced ViewsDefining Kanban View in Odoo15 | Advanced Views
Defining Kanban View in Odoo15 | Advanced ViewsCeline George
 
Impact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesImpact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesOdoo
 
Learn How to Manage Storage Locations Odoo 15
Learn How to Manage Storage Locations Odoo 15Learn How to Manage Storage Locations Odoo 15
Learn How to Manage Storage Locations Odoo 15Celine George
 
Best Tools for first time Odoo Development
Best Tools for first time Odoo DevelopmentBest Tools for first time Odoo Development
Best Tools for first time Odoo DevelopmentOdoo
 
An in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMAn in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMOdoo
 
Creating Menu and Actions in Odoo 15
Creating Menu and Actions in Odoo 15Creating Menu and Actions in Odoo 15
Creating Menu and Actions in Odoo 15Celine George
 
Workcenter in Odoo Manufacturing
Workcenter in Odoo ManufacturingWorkcenter in Odoo Manufacturing
Workcenter in Odoo ManufacturingVarsha Technaureus
 
Odoo 15 purchase management
Odoo 15 purchase managementOdoo 15 purchase management
Odoo 15 purchase managementCeline George
 
How to Build Custom Module in Odoo 15
How to Build Custom Module in Odoo 15How to Build Custom Module in Odoo 15
How to Build Custom Module in Odoo 15Celine George
 
Tp2 - OPEN ERP (2)
Tp2 - OPEN ERP (2)Tp2 - OPEN ERP (2)
Tp2 - OPEN ERP (2)Lilia Sfaxi
 

Tendances (20)

scaffold method odoo 16
scaffold method odoo 16scaffold method odoo 16
scaffold method odoo 16
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
 
Owl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOwl: The New Odoo UI Framework
Owl: The New Odoo UI Framework
 
The Odoo JS Framework
The Odoo JS FrameworkThe Odoo JS Framework
The Odoo JS Framework
 
Rapport jeu en JAVA
Rapport jeu en JAVARapport jeu en JAVA
Rapport jeu en JAVA
 
Configuring Route and Rule in Odoo 15
Configuring Route and Rule in Odoo 15Configuring Route and Rule in Odoo 15
Configuring Route and Rule in Odoo 15
 
Lot or Serial Number Configuration in Odoo 15
Lot or Serial Number Configuration in Odoo 15Lot or Serial Number Configuration in Odoo 15
Lot or Serial Number Configuration in Odoo 15
 
How to update currency exchange rates automatically in Odoo
How to update currency exchange rates automatically in OdooHow to update currency exchange rates automatically in Odoo
How to update currency exchange rates automatically in Odoo
 
Odoo 15 Composition of Module
Odoo 15 Composition of ModuleOdoo 15 Composition of Module
Odoo 15 Composition of Module
 
Defining Gantt View in Odoo 15
Defining Gantt View in Odoo 15Defining Gantt View in Odoo 15
Defining Gantt View in Odoo 15
 
Defining Kanban View in Odoo15 | Advanced Views
Defining Kanban View in Odoo15 | Advanced ViewsDefining Kanban View in Odoo15 | Advanced Views
Defining Kanban View in Odoo15 | Advanced Views
 
Impact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesImpact of the New ORM on Your Modules
Impact of the New ORM on Your Modules
 
Learn How to Manage Storage Locations Odoo 15
Learn How to Manage Storage Locations Odoo 15Learn How to Manage Storage Locations Odoo 15
Learn How to Manage Storage Locations Odoo 15
 
Best Tools for first time Odoo Development
Best Tools for first time Odoo DevelopmentBest Tools for first time Odoo Development
Best Tools for first time Odoo Development
 
An in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMAn in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORM
 
Creating Menu and Actions in Odoo 15
Creating Menu and Actions in Odoo 15Creating Menu and Actions in Odoo 15
Creating Menu and Actions in Odoo 15
 
Workcenter in Odoo Manufacturing
Workcenter in Odoo ManufacturingWorkcenter in Odoo Manufacturing
Workcenter in Odoo Manufacturing
 
Odoo 15 purchase management
Odoo 15 purchase managementOdoo 15 purchase management
Odoo 15 purchase management
 
How to Build Custom Module in Odoo 15
How to Build Custom Module in Odoo 15How to Build Custom Module in Odoo 15
How to Build Custom Module in Odoo 15
 
Tp2 - OPEN ERP (2)
Tp2 - OPEN ERP (2)Tp2 - OPEN ERP (2)
Tp2 - OPEN ERP (2)
 

Similaire à What is Computed Fields and @api Depends in Odoo 15

Inline function
Inline functionInline function
Inline functionTech_MX
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdfziyadaslanbey
 
C++ Function
C++ FunctionC++ Function
C++ FunctionHajar
 
Handout # 3 functions c++
Handout # 3   functions c++Handout # 3   functions c++
Handout # 3 functions c++NUST Stuff
 
CONST-- once initialised, no one can change it
CONST-- once initialised, no one can change itCONST-- once initialised, no one can change it
CONST-- once initialised, no one can change itAjay Chimmani
 
Workflow demo
Workflow demoWorkflow demo
Workflow demoKamal Raj
 
How to build a react native app with the help of react native hooks
How to build a react native app with the help of react native hooksHow to build a react native app with the help of react native hooks
How to build a react native app with the help of react native hooksKaty Slemon
 
overloading in C++
overloading in C++overloading in C++
overloading in C++Prof Ansari
 

Similaire à What is Computed Fields and @api Depends in Odoo 15 (20)

Project two c++ tutorial
Project two c++ tutorialProject two c++ tutorial
Project two c++ tutorial
 
Presentation 2.pptx
Presentation 2.pptxPresentation 2.pptx
Presentation 2.pptx
 
Inline function
Inline functionInline function
Inline function
 
Compose Camp - Session3.pptx
Compose Camp - Session3.pptxCompose Camp - Session3.pptx
Compose Camp - Session3.pptx
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdf
 
Simple Java Programs
Simple Java ProgramsSimple Java Programs
Simple Java Programs
 
Simple Java Programs
Simple Java ProgramsSimple Java Programs
Simple Java Programs
 
Savitch ch 11
Savitch ch 11Savitch ch 11
Savitch ch 11
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
Handout # 3 functions c++
Handout # 3   functions c++Handout # 3   functions c++
Handout # 3 functions c++
 
Function in C++
Function in C++Function in C++
Function in C++
 
CONST-- once initialised, no one can change it
CONST-- once initialised, no one can change itCONST-- once initialised, no one can change it
CONST-- once initialised, no one can change it
 
Savitch Ch 11
Savitch Ch 11Savitch Ch 11
Savitch Ch 11
 
Workflow demo
Workflow demoWorkflow demo
Workflow demo
 
How to build a react native app with the help of react native hooks
How to build a react native app with the help of react native hooksHow to build a react native app with the help of react native hooks
How to build a react native app with the help of react native hooks
 
overloading in C++
overloading in C++overloading in C++
overloading in C++
 
Control structures
Control structuresControl structures
Control structures
 

Plus de Celine George

How to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales AppHow to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales AppCeline George
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
How to Manage Engineering to Order in Odoo 17
How to Manage Engineering to Order in Odoo 17How to Manage Engineering to Order in Odoo 17
How to Manage Engineering to Order in Odoo 17Celine George
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Celine George
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 

Plus de Celine George (20)

How to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales AppHow to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales App
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
How to Manage Engineering to Order in Odoo 17
How to Manage Engineering to Order in Odoo 17How to Manage Engineering to Order in Odoo 17
How to Manage Engineering to Order in Odoo 17
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 

Dernier

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Dernier (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

What is Computed Fields and @api Depends in Odoo 15

  • 1. Computed Field`s & @api Depends on Odoo 15 www.cybrosys.com
  • 2. INTRODUCTION A computed field is declared just like any other regular field in Odoo along with the additional argument compute. The value is the name of the function as a string or a function. In this video, we are going to learn about computing fields, how it works, and @api.depends on Odoo 15.
  • 3. ❖ Let’s go to custom module ‘Travel Management’, At here we can define another field Such as ‘Total Amount’ which is a product of ‘No. of Days’ and ‘Amount Per Day’, That can be declared using compute function.
  • 4. ❖ So, at the pycharm, Let’s define that field, here i am defining it as ‘Total Amount’ as an ‘Integer’ field. First step in the compute function is that, we need to define that compute function along with the field. That is, ‘compute=’_compute_amount’’. Here The ‘_compute_amount’ is the function name.
  • 5. ❖ Then we have to return the function, So first thing we need to add is ‘@api.depends’, for that we need to import ‘api’ from odoo, ‘@api.depends’ is an ‘api’ operation it depends on some other field of same table or some other table. Which means our ‘total_amount’ is depend upon the ‘no_of_days’ and ‘amount_per_day’. So in the ‘@api.depends’ operation we can add those two fields.
  • 6. ❖ Here one of the field get changed it will depend upon the ‘total_amount’ that we are going to compute.And let’s define our compute function like below, ❖ So, This function_name we declared in the field ‘total_amount’.
  • 7. ❖ Then we can loop through each records.
  • 8. ❖ Here add a loop for this function. That is, if ‘no_of_days’ is available.
  • 9. ❖ Then Let’s define the amount. That is, the product of ‘rec.no_of_days’ and ‘rec.amount_per_day’ is stored in the field ‘rec.total_amount’.
  • 10. ❖ Instead of the else condition setting it as ‘rec.total_amount’ is false. This means if there is no ‘no_of_days’ is given.
  • 11. ❖ Now, We have to add the ‘total_amount’ field in the xml also,
  • 12. ❖ After Upgrading the module, Let’s check the field in the ‘travel.travel’ model. Here you can see the Field ‘total_amount’
  • 13. ❖ Here, Let’s see the field ‘total_amount’, which is the product of ‘no_of_days’ and ‘amount_per_day’. Likewise The compute function works.
  • 14. For More Details Check our company website for related blogs and Odoo book. Odoo Book V15 Check our YouTube channel for functional and technical videos in Odoo. Computed Fields and @api Depends on Odoo 15
  • 15.