SlideShare a Scribd company logo
Model Constraints - SQL
Constraints Odoo 16
● SQL Constraints which are defined through the model attribute
_sql_constraints.
● SQL Constraints also give the same purpose of python
constraints.
● SQL Constraints helps to set validation for the recordsets,which
act as a reminder for the user for the workflow.
Types Of SQL Constraints
1. Not Null
2. Check
3. Unique
How SQL Constraints Work
Example Model:
Class TestModel(model.Model):
_name=’test.model’
_description=’Test Model’
name=fields.Char()
channel_type=fields.Selection([(‘chat’,’Chat’),(‘channel’,’Channel’)])
probability=fields.Float()
Not Null
This constraint ensures that no field can be empty or null.
Eg : _sql_constraints=[(‘channel_type_not_null’,’CHECK(channel_type IS NOT NULL)’,The
Channel Type Cannot be Empty’)]
● This is a tuple that defines a single check constraint.
● The first member of the tuple “channel_type_not_null” is a string that defines the constraints
name.The name may be whatever you like as long as it is unique to the model.
Not Null
● The second member of the tuple,CHECK(channel_type IS NOT NULL), defines the
check constraint.In this case ,the constraint checks whether the channel_type field is
not null.If the channel_type field is null,the constraint will be violated and an error will be
raised.
● The third member of the tuple,’The Channel Type Cannot be Empty’,is a string that
provides an error message that will be displayed to the user if the constraint is violated.
Check
This Constraint allows users to define custom rules that must be met for a field.
Check Constraint is a rule that restricts the data that can be inserted or updated in a table,to
ensure data integrity and consistency.
Eg : _sql_constraints=[(‘check_probabilty’,’CHECK(probability>=0 and
probability<=0)’,The Probability should be Between 0% and 100%!’ )]
Check
● The first member of the tuple “check_probability” is a string that defines the constraints
name.The name may be whatever you like as long as it is unique to the model.
● The second member,checks the value of the “probability” field in the table between 0
and 100(inclusive) using the SQL “check” constraint.
● This is a tuple that defines a single check constraint.
Unique
This constraint ensures that each value in a field is unique.
Eg : _sql_constraints = [(‘uniq_name_’,UNIQUE(name)’, ‘Name Must Be
Unique’)]
● The First element is the constraint name
● The Second element defines unique constraint,In this case the
constraint ensures that each value in the name fields is unique across all
records in the table associated with the model.
● The Third element be the warning message.
Check our company website
for related blogs and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Ad

More Related Content

What's hot (20)

Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...
Ahmed Elshayeb
 
Owl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOwl: The New Odoo UI Framework
Owl: The New Odoo UI Framework
Odoo
 
How to show warning _ error messages in Odoo 16
How to show warning _ error messages in Odoo 16 How to show warning _ error messages in Odoo 16
How to show warning _ error messages in Odoo 16
Celine George
 
How to remove disable an oa framework personalization (doc id 304670
How to remove  disable an oa framework personalization (doc id 304670How to remove  disable an oa framework personalization (doc id 304670
How to remove disable an oa framework personalization (doc id 304670
Ahmad Mkade
 
Basic Views in Odoo 16
Basic Views in Odoo 16Basic Views in Odoo 16
Basic Views in Odoo 16
Celine George
 
Oracle EBS R 12 Core hr user manual
Oracle EBS R 12 Core hr user manualOracle EBS R 12 Core hr user manual
Oracle EBS R 12 Core hr user manual
Feras Ahmad
 
Step by step guide to basic web dynpro abap
Step by step guide to basic web dynpro abapStep by step guide to basic web dynpro abap
Step by step guide to basic web dynpro abap
Kranthi Kumar
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
Mindfire Solutions
 
Oracle 11i forms personalization
Oracle 11i forms personalizationOracle 11i forms personalization
Oracle 11i forms personalization
Kaushik Kumar Kuberanathan
 
Oracle iProcurement
Oracle iProcurementOracle iProcurement
Oracle iProcurement
Baker Khader Abdallah, PMP
 
Javascript under the hood 1
Javascript under the hood 1Javascript under the hood 1
Javascript under the hood 1
Thang Tran Duc
 
ADO.NET
ADO.NETADO.NET
ADO.NET
Wani Zahoor
 
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
 
Extensibility
ExtensibilityExtensibility
Extensibility
mohamed refaei
 
Run report from menu Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...
Run report from menu  Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...Run report from menu  Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...
Run report from menu Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...
Ahmed Elshayeb
 
Oaf personaliztion examples
Oaf personaliztion examplesOaf personaliztion examples
Oaf personaliztion examples
Kaushik Kumar Kuberanathan
 
Oracle Apps Technical – Short notes on RICE Components.
Oracle Apps Technical – Short notes on RICE Components.Oracle Apps Technical – Short notes on RICE Components.
Oracle Apps Technical – Short notes on RICE Components.
Boopathy CS
 
Oracle Concurrent Program Setup document
Oracle Concurrent Program Setup  documentOracle Concurrent Program Setup  document
Oracle Concurrent Program Setup document
venkatesh gurusamy
 
Ejercicio resuelto de punto de caso de uso
Ejercicio resuelto de punto de caso de usoEjercicio resuelto de punto de caso de uso
Ejercicio resuelto de punto de caso de uso
Adri Campos
 
Oracle r12 eb tax sql queries for functional implementers for troubleshooting...
Oracle r12 eb tax sql queries for functional implementers for troubleshooting...Oracle r12 eb tax sql queries for functional implementers for troubleshooting...
Oracle r12 eb tax sql queries for functional implementers for troubleshooting...
flower705
 
Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...
Ahmed Elshayeb
 
Owl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOwl: The New Odoo UI Framework
Owl: The New Odoo UI Framework
Odoo
 
How to show warning _ error messages in Odoo 16
How to show warning _ error messages in Odoo 16 How to show warning _ error messages in Odoo 16
How to show warning _ error messages in Odoo 16
Celine George
 
How to remove disable an oa framework personalization (doc id 304670
How to remove  disable an oa framework personalization (doc id 304670How to remove  disable an oa framework personalization (doc id 304670
How to remove disable an oa framework personalization (doc id 304670
Ahmad Mkade
 
Basic Views in Odoo 16
Basic Views in Odoo 16Basic Views in Odoo 16
Basic Views in Odoo 16
Celine George
 
Oracle EBS R 12 Core hr user manual
Oracle EBS R 12 Core hr user manualOracle EBS R 12 Core hr user manual
Oracle EBS R 12 Core hr user manual
Feras Ahmad
 
Step by step guide to basic web dynpro abap
Step by step guide to basic web dynpro abapStep by step guide to basic web dynpro abap
Step by step guide to basic web dynpro abap
Kranthi Kumar
 
Javascript under the hood 1
Javascript under the hood 1Javascript under the hood 1
Javascript under the hood 1
Thang Tran Duc
 
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
 
Run report from menu Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...
Run report from menu  Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...Run report from menu  Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...
Run report from menu Personalization كيفية تشغيل تقرير أو ما شابة من خلال شا...
Ahmed Elshayeb
 
Oracle Apps Technical – Short notes on RICE Components.
Oracle Apps Technical – Short notes on RICE Components.Oracle Apps Technical – Short notes on RICE Components.
Oracle Apps Technical – Short notes on RICE Components.
Boopathy CS
 
Oracle Concurrent Program Setup document
Oracle Concurrent Program Setup  documentOracle Concurrent Program Setup  document
Oracle Concurrent Program Setup document
venkatesh gurusamy
 
Ejercicio resuelto de punto de caso de uso
Ejercicio resuelto de punto de caso de usoEjercicio resuelto de punto de caso de uso
Ejercicio resuelto de punto de caso de uso
Adri Campos
 
Oracle r12 eb tax sql queries for functional implementers for troubleshooting...
Oracle r12 eb tax sql queries for functional implementers for troubleshooting...Oracle r12 eb tax sql queries for functional implementers for troubleshooting...
Oracle r12 eb tax sql queries for functional implementers for troubleshooting...
flower705
 

Similar to Model Constraints - SQL Constraints Odoo 16 (20)

How to Use Constraint and SQL Constraint in Odoo 15
How to Use Constraint and SQL Constraint in Odoo 15How to Use Constraint and SQL Constraint in Odoo 15
How to Use Constraint and SQL Constraint in Odoo 15
Celine George
 
Oracle SQL Fundamentals - Lecture 3
Oracle SQL Fundamentals - Lecture 3Oracle SQL Fundamentals - Lecture 3
Oracle SQL Fundamentals - Lecture 3
MuhammadWaheed44
 
Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18
Celine George
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
Megha yadav
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
1.Implementing_Data_Integrity.pdf
1.Implementing_Data_Integrity.pdf1.Implementing_Data_Integrity.pdf
1.Implementing_Data_Integrity.pdf
diaa46
 
Bn1017 a demo rdbms
Bn1017 a demo  rdbmsBn1017 a demo  rdbms
Bn1017 a demo rdbms
conline training
 
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)  Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
MuhammadWaheed44
 
Sql integrity constraints
Sql integrity constraintsSql integrity constraints
Sql integrity constraints
Vivek Singh
 
Entigrity constraint
Entigrity constraintEntigrity constraint
Entigrity constraint
suman kumar
 
SQL POWERPOINT PRESENTATION ON SQL .pptx
SQL POWERPOINT PRESENTATION ON SQL .pptxSQL POWERPOINT PRESENTATION ON SQL .pptx
SQL POWERPOINT PRESENTATION ON SQL .pptx
alakeshbarua2
 
Oracle SQL Part 2
Oracle SQL Part 2Oracle SQL Part 2
Oracle SQL Part 2
Gurpreet singh
 
RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)
Muhammad T Q Nafis
 
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12  CBSESQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12  CBSE
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
sdnsdf
 
SQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update featureSQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update feature
Frans Jongma
 
Bn1037 demo oracle sql
Bn1037 demo  oracle sqlBn1037 demo  oracle sql
Bn1037 demo oracle sql
conline training
 
Constraints constraints of oracle data base management systems
Constraints  constraints of oracle data base management systemsConstraints  constraints of oracle data base management systems
Constraints constraints of oracle data base management systems
SHAKIR325211
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used
TheVerse1
 
Database constraints
Database constraintsDatabase constraints
Database constraints
Khadija Parween
 
Dms 22319 micro project
Dms 22319 micro projectDms 22319 micro project
Dms 22319 micro project
ARVIND SARDAR
 
How to Use Constraint and SQL Constraint in Odoo 15
How to Use Constraint and SQL Constraint in Odoo 15How to Use Constraint and SQL Constraint in Odoo 15
How to Use Constraint and SQL Constraint in Odoo 15
Celine George
 
Oracle SQL Fundamentals - Lecture 3
Oracle SQL Fundamentals - Lecture 3Oracle SQL Fundamentals - Lecture 3
Oracle SQL Fundamentals - Lecture 3
MuhammadWaheed44
 
Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18
Celine George
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
Megha yadav
 
1.Implementing_Data_Integrity.pdf
1.Implementing_Data_Integrity.pdf1.Implementing_Data_Integrity.pdf
1.Implementing_Data_Integrity.pdf
diaa46
 
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)  Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
MuhammadWaheed44
 
Sql integrity constraints
Sql integrity constraintsSql integrity constraints
Sql integrity constraints
Vivek Singh
 
Entigrity constraint
Entigrity constraintEntigrity constraint
Entigrity constraint
suman kumar
 
SQL POWERPOINT PRESENTATION ON SQL .pptx
SQL POWERPOINT PRESENTATION ON SQL .pptxSQL POWERPOINT PRESENTATION ON SQL .pptx
SQL POWERPOINT PRESENTATION ON SQL .pptx
alakeshbarua2
 
RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)
Muhammad T Q Nafis
 
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12  CBSESQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12  CBSE
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
sdnsdf
 
SQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update featureSQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update feature
Frans Jongma
 
Constraints constraints of oracle data base management systems
Constraints  constraints of oracle data base management systemsConstraints  constraints of oracle data base management systems
Constraints constraints of oracle data base management systems
SHAKIR325211
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used
TheVerse1
 
Dms 22319 micro project
Dms 22319 micro projectDms 22319 micro project
Dms 22319 micro project
ARVIND SARDAR
 
Ad

More from Celine George (20)

How to Manage Cross Selling in Odoo 18 Sales
How to Manage Cross Selling in Odoo 18 SalesHow to Manage Cross Selling in Odoo 18 Sales
How to Manage Cross Selling in Odoo 18 Sales
Celine George
 
How to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale OrderHow to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale Order
Celine George
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18
Celine George
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
How to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo SlidesHow to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo Slides
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
How to Manage Cross Selling in Odoo 18 Sales
How to Manage Cross Selling in Odoo 18 SalesHow to Manage Cross Selling in Odoo 18 Sales
How to Manage Cross Selling in Odoo 18 Sales
Celine George
 
How to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale OrderHow to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale Order
Celine George
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18
Celine George
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
How to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo SlidesHow to Add Button in Chatter in Odoo 18 - Odoo Slides
How to Add Button in Chatter in Odoo 18 - Odoo Slides
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
Ad

Recently uploaded (20)

MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM & Mia eStudios
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM & Mia eStudios
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
UPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guideUPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guide
abmerca
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM & Mia eStudios
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM & Mia eStudios
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
UPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guideUPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guide
abmerca
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 

Model Constraints - SQL Constraints Odoo 16

  • 1. Model Constraints - SQL Constraints Odoo 16
  • 2. ● SQL Constraints which are defined through the model attribute _sql_constraints. ● SQL Constraints also give the same purpose of python constraints. ● SQL Constraints helps to set validation for the recordsets,which act as a reminder for the user for the workflow.
  • 3. Types Of SQL Constraints 1. Not Null 2. Check 3. Unique
  • 4. How SQL Constraints Work Example Model: Class TestModel(model.Model): _name=’test.model’ _description=’Test Model’ name=fields.Char() channel_type=fields.Selection([(‘chat’,’Chat’),(‘channel’,’Channel’)]) probability=fields.Float()
  • 5. Not Null This constraint ensures that no field can be empty or null. Eg : _sql_constraints=[(‘channel_type_not_null’,’CHECK(channel_type IS NOT NULL)’,The Channel Type Cannot be Empty’)] ● This is a tuple that defines a single check constraint. ● The first member of the tuple “channel_type_not_null” is a string that defines the constraints name.The name may be whatever you like as long as it is unique to the model.
  • 6. Not Null ● The second member of the tuple,CHECK(channel_type IS NOT NULL), defines the check constraint.In this case ,the constraint checks whether the channel_type field is not null.If the channel_type field is null,the constraint will be violated and an error will be raised. ● The third member of the tuple,’The Channel Type Cannot be Empty’,is a string that provides an error message that will be displayed to the user if the constraint is violated.
  • 7. Check This Constraint allows users to define custom rules that must be met for a field. Check Constraint is a rule that restricts the data that can be inserted or updated in a table,to ensure data integrity and consistency. Eg : _sql_constraints=[(‘check_probabilty’,’CHECK(probability>=0 and probability<=0)’,The Probability should be Between 0% and 100%!’ )]
  • 8. Check ● The first member of the tuple “check_probability” is a string that defines the constraints name.The name may be whatever you like as long as it is unique to the model. ● The second member,checks the value of the “probability” field in the table between 0 and 100(inclusive) using the SQL “check” constraint. ● This is a tuple that defines a single check constraint.
  • 9. Unique This constraint ensures that each value in a field is unique. Eg : _sql_constraints = [(‘uniq_name_’,UNIQUE(name)’, ‘Name Must Be Unique’)] ● The First element is the constraint name ● The Second element defines unique constraint,In this case the constraint ensures that each value in the name fields is unique across all records in the table associated with the model. ● The Third element be the warning message.
  • 10. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo.
  翻译: