SlideShare a Scribd company logo
Creation/update: a
mandatory field is not set
in Odoo 17
Enterprise
Enterprise
In many situations, we may have encountered a Validation
Error from Odoo UI like this.
We get this error usually because the value for a required field
is not given
Enterprise
Let us check the case with an example module. Here, this
simple module just creates a new model company.employee
and the needed menus and views are defined.
Enterprise
First, the model class is defined with two basic fields name and
phone.
from odoo import fields, models
class CompanyEmployee(models.Model):
_name = 'company.employee'
_inherit = ['mail.thread']
_rec_name = 'name'
name = fields.Char(string="Name")
phone = fields.Char(string="Phone Number",
required=True)
Enterprise
Then, by inheriting the hr.employee addon model, we’ve just
created a custom button ‘Confirm’ on the Employee form view as
On clicking the button, a record in the custom model company.employee
will be created with the employee’s name and phone number.
Enterprise
Just defined the method for the button click as
from odoo import fields, models
class Employee(models.Model):
_inherit = 'hr.employee'
def action_confirm(self):
self.env['company.employee'].create({
'name': self.name,
})
Enterprise
Then, while hitting the button, the error will come as
This says that, the Field: Phone Number (phone) is mandatory to
fill while creating a record in company.employee model.
Enterprise
When we redefine the earlier method action_confirm() by filling
the value for phone field, the error will disappear and the
corresponding record will be created.
from odoo import fields, models
class Employee(models.Model):
_inherit = 'hr.employee'
def action_confirm(self):
self.env['company.employee'].create({
'name': self.name,
'phone': self.work_phone
})
Enterprise
Then, we can see the latest created record in the
company_employee model’s view as
For More Info.
Check our company website for related
blogs and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

More Related Content

Similar to Creation or Update of a Mandatory Field is Not Set in Odoo 17

PT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxPT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
amrit47
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
Celine George
 
Django forms
Django formsDjango forms
Django forms
Rubin Damian
 
contractor safety briefing
contractor safety briefingcontractor safety briefing
contractor safety briefing
hamidi32
 
Object Oriented Programming in Python
Object Oriented Programming in PythonObject Oriented Programming in Python
Object Oriented Programming in Python
Pradeep Kumar
 
CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces  CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces
HomeWork-Fox
 
Salesforce crm projects
Salesforce crm projects Salesforce crm projects
Salesforce crm projects
Advanz Knowledge Systems P Ltd
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
Celine George
 
Oracle Fusion SCM Online Training
Oracle Fusion SCM Online TrainingOracle Fusion SCM Online Training
Oracle Fusion SCM Online Training
nsai6290
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdf
murad3003
 
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
Celine George
 
_MITRA PAYROLL Final ppt..pdf
_MITRA PAYROLL  Final ppt..pdf_MITRA PAYROLL  Final ppt..pdf
_MITRA PAYROLL Final ppt..pdf
Mitra Solutions
 
How to Empty a One2Many Field in Odoo 17
How to Empty a One2Many Field in Odoo 17How to Empty a One2Many Field in Odoo 17
How to Empty a One2Many Field in Odoo 17
Celine George
 
DATABASE PROJECT
DATABASE PROJECTDATABASE PROJECT
DATABASE PROJECT
abdul basit
 
eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module
eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module
eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module
eresource infotech pvt ltd
 
4 building a joomla registration form using chrono forms
4 building a joomla registration form using chrono forms4 building a joomla registration form using chrono forms
4 building a joomla registration form using chrono forms
pvenky1578
 
Be sure to read all of Chapters 8 and 9 before starting this assignm.docx
Be sure to read all of Chapters 8 and 9 before starting this assignm.docxBe sure to read all of Chapters 8 and 9 before starting this assignm.docx
Be sure to read all of Chapters 8 and 9 before starting this assignm.docx
aman341480
 
How to set up the Employment Management System (EMS)
How to set up the Employment Management System (EMS)How to set up the Employment Management System (EMS)
How to set up the Employment Management System (EMS)
Steven Bailey
 
Cis247 i lab 5 inheritance
Cis247 i lab 5 inheritanceCis247 i lab 5 inheritance
Cis247 i lab 5 inheritance
sdjdskjd9097
 
Sales force class-3
Sales force class-3Sales force class-3
Sales force class-3
Amit Sharma
 

Similar to Creation or Update of a Mandatory Field is Not Set in Odoo 17 (20)

PT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxPT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
Django forms
Django formsDjango forms
Django forms
 
contractor safety briefing
contractor safety briefingcontractor safety briefing
contractor safety briefing
 
Object Oriented Programming in Python
Object Oriented Programming in PythonObject Oriented Programming in Python
Object Oriented Programming in Python
 
CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces  CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces
 
Salesforce crm projects
Salesforce crm projects Salesforce crm projects
Salesforce crm projects
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Oracle Fusion SCM Online Training
Oracle Fusion SCM Online TrainingOracle Fusion SCM Online Training
Oracle Fusion SCM Online Training
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdf
 
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
 
_MITRA PAYROLL Final ppt..pdf
_MITRA PAYROLL  Final ppt..pdf_MITRA PAYROLL  Final ppt..pdf
_MITRA PAYROLL Final ppt..pdf
 
How to Empty a One2Many Field in Odoo 17
How to Empty a One2Many Field in Odoo 17How to Empty a One2Many Field in Odoo 17
How to Empty a One2Many Field in Odoo 17
 
DATABASE PROJECT
DATABASE PROJECTDATABASE PROJECT
DATABASE PROJECT
 
eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module
eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module
eresource Xcel ERP | ERP For Manufaturing Indusrty | Admin Module
 
4 building a joomla registration form using chrono forms
4 building a joomla registration form using chrono forms4 building a joomla registration form using chrono forms
4 building a joomla registration form using chrono forms
 
Be sure to read all of Chapters 8 and 9 before starting this assignm.docx
Be sure to read all of Chapters 8 and 9 before starting this assignm.docxBe sure to read all of Chapters 8 and 9 before starting this assignm.docx
Be sure to read all of Chapters 8 and 9 before starting this assignm.docx
 
How to set up the Employment Management System (EMS)
How to set up the Employment Management System (EMS)How to set up the Employment Management System (EMS)
How to set up the Employment Management System (EMS)
 
Cis247 i lab 5 inheritance
Cis247 i lab 5 inheritanceCis247 i lab 5 inheritance
Cis247 i lab 5 inheritance
 
Sales force class-3
Sales force class-3Sales force class-3
Sales force class-3
 

More from Celine George

Reports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo SlidesReports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo Slides
Celine George
 
New Features in Odoo 17 Email Marketing - Odoo Slides
New Features in Odoo 17 Email Marketing - Odoo SlidesNew Features in Odoo 17 Email Marketing - Odoo Slides
New Features in Odoo 17 Email Marketing - Odoo Slides
Celine George
 
How to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 SlidesHow to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 Slides
Celine George
 
How to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo SlidesHow to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo Slides
Celine George
 
How to Set Default Filter in Search View / Set Default Filter For Menu In Odoo
How to Set Default Filter in Search View / Set Default Filter For Menu In OdooHow to Set Default Filter in Search View / Set Default Filter For Menu In Odoo
How to Set Default Filter in Search View / Set Default Filter For Menu In Odoo
Celine George
 
How To Set Default Group By For Menu Action In Odoo
How To Set Default Group By For Menu Action In OdooHow To Set Default Group By For Menu Action In Odoo
How To Set Default Group By For Menu Action In Odoo
Celine George
 
How to Use Pre Init hook in Odoo 17 -Odoo 17 Slides
How to Use Pre Init hook in Odoo 17 -Odoo 17 SlidesHow to Use Pre Init hook in Odoo 17 -Odoo 17 Slides
How to Use Pre Init hook in Odoo 17 -Odoo 17 Slides
Celine George
 
Demonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 SlidesDemonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 Slides
Celine George
 
How to Activate & Create Sales Receipts in Odoo 17
How to Activate & Create Sales Receipts in Odoo 17How to Activate & Create Sales Receipts in Odoo 17
How to Activate & Create Sales Receipts in Odoo 17
Celine George
 
Odoo 17 Events - Attendees List Scanning
Odoo 17 Events - Attendees List ScanningOdoo 17 Events - Attendees List Scanning
Odoo 17 Events - Attendees List Scanning
Celine George
 
E-learning Odoo 17 New features - Odoo 17 Slides
E-learning Odoo 17  New features - Odoo 17 SlidesE-learning Odoo 17  New features - Odoo 17 Slides
E-learning Odoo 17 New features - Odoo 17 Slides
Celine George
 
Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17
Celine George
 
View Inheritance in Odoo 17 - Odoo 17 Slides
View Inheritance in Odoo 17 - Odoo 17  SlidesView Inheritance in Odoo 17 - Odoo 17  Slides
View Inheritance in Odoo 17 - Odoo 17 Slides
Celine George
 
How to Manage Line Discount in Odoo 17 POS
How to Manage Line Discount in Odoo 17 POSHow to Manage Line Discount in Odoo 17 POS
How to Manage Line Discount in Odoo 17 POS
Celine George
 
How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17
Celine George
 
How to Manage Shipping Connectors & Shipping Methods in Odoo 17
How to Manage Shipping Connectors & Shipping Methods in Odoo 17How to Manage Shipping Connectors & Shipping Methods in Odoo 17
How to Manage Shipping Connectors & Shipping Methods in Odoo 17
Celine George
 
New Features in Odoo 17 Sign - Odoo 17 Slides
New Features in Odoo 17 Sign - Odoo 17 SlidesNew Features in Odoo 17 Sign - Odoo 17 Slides
New Features in Odoo 17 Sign - Odoo 17 Slides
Celine George
 
How to Manage Early Receipt Printing in Odoo 17 POS
How to Manage Early Receipt Printing in Odoo 17 POSHow to Manage Early Receipt Printing in Odoo 17 POS
How to Manage Early Receipt Printing in Odoo 17 POS
Celine George
 
What is Rescue Session in Odoo 17 POS - Odoo 17 Slides
What is Rescue Session in Odoo 17 POS - Odoo 17 SlidesWhat is Rescue Session in Odoo 17 POS - Odoo 17 Slides
What is Rescue Session in Odoo 17 POS - Odoo 17 Slides
Celine George
 
How to Add a Filter in the Odoo 17 - Odoo 17 Slides
How to Add a Filter in the Odoo 17 - Odoo 17 SlidesHow to Add a Filter in the Odoo 17 - Odoo 17 Slides
How to Add a Filter in the Odoo 17 - Odoo 17 Slides
Celine George
 

More from Celine George (20)

Reports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo SlidesReports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo Slides
 
New Features in Odoo 17 Email Marketing - Odoo Slides
New Features in Odoo 17 Email Marketing - Odoo SlidesNew Features in Odoo 17 Email Marketing - Odoo Slides
New Features in Odoo 17 Email Marketing - Odoo Slides
 
How to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 SlidesHow to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 Slides
 
How to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo SlidesHow to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo Slides
 
How to Set Default Filter in Search View / Set Default Filter For Menu In Odoo
How to Set Default Filter in Search View / Set Default Filter For Menu In OdooHow to Set Default Filter in Search View / Set Default Filter For Menu In Odoo
How to Set Default Filter in Search View / Set Default Filter For Menu In Odoo
 
How To Set Default Group By For Menu Action In Odoo
How To Set Default Group By For Menu Action In OdooHow To Set Default Group By For Menu Action In Odoo
How To Set Default Group By For Menu Action In Odoo
 
How to Use Pre Init hook in Odoo 17 -Odoo 17 Slides
How to Use Pre Init hook in Odoo 17 -Odoo 17 SlidesHow to Use Pre Init hook in Odoo 17 -Odoo 17 Slides
How to Use Pre Init hook in Odoo 17 -Odoo 17 Slides
 
Demonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 SlidesDemonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 Slides
 
How to Activate & Create Sales Receipts in Odoo 17
How to Activate & Create Sales Receipts in Odoo 17How to Activate & Create Sales Receipts in Odoo 17
How to Activate & Create Sales Receipts in Odoo 17
 
Odoo 17 Events - Attendees List Scanning
Odoo 17 Events - Attendees List ScanningOdoo 17 Events - Attendees List Scanning
Odoo 17 Events - Attendees List Scanning
 
E-learning Odoo 17 New features - Odoo 17 Slides
E-learning Odoo 17  New features - Odoo 17 SlidesE-learning Odoo 17  New features - Odoo 17 Slides
E-learning Odoo 17 New features - Odoo 17 Slides
 
Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17
 
View Inheritance in Odoo 17 - Odoo 17 Slides
View Inheritance in Odoo 17 - Odoo 17  SlidesView Inheritance in Odoo 17 - Odoo 17  Slides
View Inheritance in Odoo 17 - Odoo 17 Slides
 
How to Manage Line Discount in Odoo 17 POS
How to Manage Line Discount in Odoo 17 POSHow to Manage Line Discount in Odoo 17 POS
How to Manage Line Discount in Odoo 17 POS
 
How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17
 
How to Manage Shipping Connectors & Shipping Methods in Odoo 17
How to Manage Shipping Connectors & Shipping Methods in Odoo 17How to Manage Shipping Connectors & Shipping Methods in Odoo 17
How to Manage Shipping Connectors & Shipping Methods in Odoo 17
 
New Features in Odoo 17 Sign - Odoo 17 Slides
New Features in Odoo 17 Sign - Odoo 17 SlidesNew Features in Odoo 17 Sign - Odoo 17 Slides
New Features in Odoo 17 Sign - Odoo 17 Slides
 
How to Manage Early Receipt Printing in Odoo 17 POS
How to Manage Early Receipt Printing in Odoo 17 POSHow to Manage Early Receipt Printing in Odoo 17 POS
How to Manage Early Receipt Printing in Odoo 17 POS
 
What is Rescue Session in Odoo 17 POS - Odoo 17 Slides
What is Rescue Session in Odoo 17 POS - Odoo 17 SlidesWhat is Rescue Session in Odoo 17 POS - Odoo 17 Slides
What is Rescue Session in Odoo 17 POS - Odoo 17 Slides
 
How to Add a Filter in the Odoo 17 - Odoo 17 Slides
How to Add a Filter in the Odoo 17 - Odoo 17 SlidesHow to Add a Filter in the Odoo 17 - Odoo 17 Slides
How to Add a Filter in the Odoo 17 - Odoo 17 Slides
 

Recently uploaded

SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptxSD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
elwoodprias1
 
Introduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal UseIntroduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal Use
Excellence Foundation for South Sudan
 
RDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEWRDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEW
Murugan Solaiyappan
 
NAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource BookNAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource Book
lakitawilson
 
Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...
Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...
Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...
Alvaro Barbosa
 
How to Manage Large Scrollbar in Odoo 17 POS
How to Manage Large Scrollbar in Odoo 17 POSHow to Manage Large Scrollbar in Odoo 17 POS
How to Manage Large Scrollbar in Odoo 17 POS
Celine George
 
SEQUNCES Lecture_Notes_Unit4_chapter11_sequence
SEQUNCES  Lecture_Notes_Unit4_chapter11_sequenceSEQUNCES  Lecture_Notes_Unit4_chapter11_sequence
SEQUNCES Lecture_Notes_Unit4_chapter11_sequence
Murugan Solaiyappan
 
Our Guide to the July 2024 USPS® Rate Change
Our Guide to the July 2024 USPS® Rate ChangeOur Guide to the July 2024 USPS® Rate Change
Our Guide to the July 2024 USPS® Rate Change
Postal Advocate Inc.
 
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour International
 
11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx
11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx
11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx
mansk2
 
Allopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation PowerpointAllopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation Powerpoint
Julie Sarpy
 
1. Importance_of_reducing_postharvest_loss.pptx
1. Importance_of_reducing_postharvest_loss.pptx1. Importance_of_reducing_postharvest_loss.pptx
1. Importance_of_reducing_postharvest_loss.pptx
UmeshTimilsina1
 
ASP.NET Core Interview Questions PDF By ScholarHat.pdf
ASP.NET Core Interview Questions PDF By ScholarHat.pdfASP.NET Core Interview Questions PDF By ScholarHat.pdf
ASP.NET Core Interview Questions PDF By ScholarHat.pdf
Scholarhat
 
Introduction to Banking System in India.ppt
Introduction to Banking System in India.pptIntroduction to Banking System in India.ppt
Introduction to Banking System in India.ppt
Dr. S. Bulomine Regi
 
matatag curriculum education for Kindergarten
matatag curriculum education for Kindergartenmatatag curriculum education for Kindergarten
matatag curriculum education for Kindergarten
SarahAlie1
 
The Cruelty of Animal Testing in the Industry.pdf
The Cruelty of Animal Testing in the Industry.pdfThe Cruelty of Animal Testing in the Industry.pdf
The Cruelty of Animal Testing in the Industry.pdf
luzmilaglez334
 
Parent PD Design for Professional Development .docx
Parent PD Design for Professional Development .docxParent PD Design for Professional Development .docx
Parent PD Design for Professional Development .docx
AntonioJarligoCompra
 
A beginner’s guide to project reviews - everything you wanted to know but wer...
A beginner’s guide to project reviews - everything you wanted to know but wer...A beginner’s guide to project reviews - everything you wanted to know but wer...
A beginner’s guide to project reviews - everything you wanted to know but wer...
Association for Project Management
 
MVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHatMVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHat
Scholarhat
 
formative Evaluation By Dr.Kshirsagar R.V
formative Evaluation By Dr.Kshirsagar R.Vformative Evaluation By Dr.Kshirsagar R.V
formative Evaluation By Dr.Kshirsagar R.V
DrRavindrakshirsagar1
 

Recently uploaded (20)

SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptxSD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
 
Introduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal UseIntroduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal Use
 
RDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEWRDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEW
 
NAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource BookNAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource Book
 
Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...
Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...
Benchmarking Sustainability: Neurosciences and AI Tech Research in Macau - Ke...
 
How to Manage Large Scrollbar in Odoo 17 POS
How to Manage Large Scrollbar in Odoo 17 POSHow to Manage Large Scrollbar in Odoo 17 POS
How to Manage Large Scrollbar in Odoo 17 POS
 
SEQUNCES Lecture_Notes_Unit4_chapter11_sequence
SEQUNCES  Lecture_Notes_Unit4_chapter11_sequenceSEQUNCES  Lecture_Notes_Unit4_chapter11_sequence
SEQUNCES Lecture_Notes_Unit4_chapter11_sequence
 
Our Guide to the July 2024 USPS® Rate Change
Our Guide to the July 2024 USPS® Rate ChangeOur Guide to the July 2024 USPS® Rate Change
Our Guide to the July 2024 USPS® Rate Change
 
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
 
11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx
11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx
11EHS Term 3 Week 1 Unit 1 Review: Feedback and improvementpptx
 
Allopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation PowerpointAllopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation Powerpoint
 
1. Importance_of_reducing_postharvest_loss.pptx
1. Importance_of_reducing_postharvest_loss.pptx1. Importance_of_reducing_postharvest_loss.pptx
1. Importance_of_reducing_postharvest_loss.pptx
 
ASP.NET Core Interview Questions PDF By ScholarHat.pdf
ASP.NET Core Interview Questions PDF By ScholarHat.pdfASP.NET Core Interview Questions PDF By ScholarHat.pdf
ASP.NET Core Interview Questions PDF By ScholarHat.pdf
 
Introduction to Banking System in India.ppt
Introduction to Banking System in India.pptIntroduction to Banking System in India.ppt
Introduction to Banking System in India.ppt
 
matatag curriculum education for Kindergarten
matatag curriculum education for Kindergartenmatatag curriculum education for Kindergarten
matatag curriculum education for Kindergarten
 
The Cruelty of Animal Testing in the Industry.pdf
The Cruelty of Animal Testing in the Industry.pdfThe Cruelty of Animal Testing in the Industry.pdf
The Cruelty of Animal Testing in the Industry.pdf
 
Parent PD Design for Professional Development .docx
Parent PD Design for Professional Development .docxParent PD Design for Professional Development .docx
Parent PD Design for Professional Development .docx
 
A beginner’s guide to project reviews - everything you wanted to know but wer...
A beginner’s guide to project reviews - everything you wanted to know but wer...A beginner’s guide to project reviews - everything you wanted to know but wer...
A beginner’s guide to project reviews - everything you wanted to know but wer...
 
MVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHatMVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHat
 
formative Evaluation By Dr.Kshirsagar R.V
formative Evaluation By Dr.Kshirsagar R.Vformative Evaluation By Dr.Kshirsagar R.V
formative Evaluation By Dr.Kshirsagar R.V
 

Creation or Update of a Mandatory Field is Not Set in Odoo 17

  • 1. Creation/update: a mandatory field is not set in Odoo 17 Enterprise
  • 2. Enterprise In many situations, we may have encountered a Validation Error from Odoo UI like this. We get this error usually because the value for a required field is not given
  • 3. Enterprise Let us check the case with an example module. Here, this simple module just creates a new model company.employee and the needed menus and views are defined.
  • 4. Enterprise First, the model class is defined with two basic fields name and phone. from odoo import fields, models class CompanyEmployee(models.Model): _name = 'company.employee' _inherit = ['mail.thread'] _rec_name = 'name' name = fields.Char(string="Name") phone = fields.Char(string="Phone Number", required=True)
  • 5. Enterprise Then, by inheriting the hr.employee addon model, we’ve just created a custom button ‘Confirm’ on the Employee form view as On clicking the button, a record in the custom model company.employee will be created with the employee’s name and phone number.
  • 6. Enterprise Just defined the method for the button click as from odoo import fields, models class Employee(models.Model): _inherit = 'hr.employee' def action_confirm(self): self.env['company.employee'].create({ 'name': self.name, })
  • 7. Enterprise Then, while hitting the button, the error will come as This says that, the Field: Phone Number (phone) is mandatory to fill while creating a record in company.employee model.
  • 8. Enterprise When we redefine the earlier method action_confirm() by filling the value for phone field, the error will disappear and the corresponding record will be created. from odoo import fields, models class Employee(models.Model): _inherit = 'hr.employee' def action_confirm(self): self.env['company.employee'].create({ 'name': self.name, 'phone': self.work_phone })
  • 9. Enterprise Then, we can see the latest created record in the company_employee model’s view as
  • 10. For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com