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.

More Related Content

What's hot

Creating business group in oracle apps
Creating business group in oracle appsCreating business group in oracle apps
Creating business group in oracle apps
Gurpreet singh
 
How to Configure Operations Types in Odoo 15
How to Configure Operations Types in Odoo 15How to Configure Operations Types in Odoo 15
How to Configure Operations Types in Odoo 15
Celine George
 
Oracle Payables R12 ivas
Oracle Payables R12 ivasOracle Payables R12 ivas
Oracle Payables R12 ivas
Ali Ibrahim
 
Ebs ecc-quick-start-guide
Ebs ecc-quick-start-guideEbs ecc-quick-start-guide
Ebs ecc-quick-start-guide
Waleed El-Zawahry
 
Fujcci crp oracle payroll
Fujcci crp oracle payrollFujcci crp oracle payroll
Fujcci crp oracle payroll
Feras Ahmad
 
Oracle Apps - Forms
Oracle Apps - FormsOracle Apps - Forms
Oracle Apps - Forms
Bhaskara Reddy Sannapureddy
 
Object Relation Mapping in Odoo 16
Object Relation Mapping in Odoo 16Object Relation Mapping in Odoo 16
Object Relation Mapping in Odoo 16
Celine George
 
8 legal structures
8   legal structures8   legal structures
8 legal structures
mohamed refaei
 
Hr profile option
Hr profile optionHr profile option
Hr profile option
Feras Ahmad
 
R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)
lingaswamy vallapu
 
Oracle Receivables R12
Oracle Receivables R12Oracle Receivables R12
Oracle Receivables R12
Sarfaraz Ahmed
 
Oracle R12 Multi org ivas
Oracle R12 Multi org ivasOracle R12 Multi org ivas
Oracle R12 Multi org ivas
Ali Ibrahim
 
IntegrationBroker
IntegrationBrokerIntegrationBroker
IntegrationBroker
meghamystic
 
Validation type 'special' in value sets
Validation type 'special' in value setsValidation type 'special' in value sets
Validation type 'special' in value sets
Feras Ahmad
 
Fast formula queries for functions, contexts, db is and packages
Fast formula queries for functions, contexts, db is and packagesFast formula queries for functions, contexts, db is and packages
Fast formula queries for functions, contexts, db is and packages
Feras Ahmad
 
View Inheritance in Odoo 16
View Inheritance in Odoo 16View Inheritance in Odoo 16
View Inheritance in Odoo 16
Celine George
 
Oracle General Ledger GL FSG
Oracle General Ledger GL FSG Oracle General Ledger GL FSG
Oracle General Ledger GL FSG
Rizwan Ali Qumbrani
 
Oracle EBS R12 Sales order personalization
Oracle EBS R12 Sales order personalizationOracle EBS R12 Sales order personalization
Oracle EBS R12 Sales order personalization
Ahmed Elshayeb
 
Oracle Fixed assets ivas
Oracle Fixed assets ivasOracle Fixed assets ivas
Oracle Fixed assets ivas
Ali Ibrahim
 
Upgrading 11i E-business Suite to R12 E-business Suite
Upgrading 11i E-business Suite to R12 E-business SuiteUpgrading 11i E-business Suite to R12 E-business Suite
Upgrading 11i E-business Suite to R12 E-business Suite
iWare Logic Technologies Pvt. Ltd.
 

What's hot (20)

Creating business group in oracle apps
Creating business group in oracle appsCreating business group in oracle apps
Creating business group in oracle apps
 
How to Configure Operations Types in Odoo 15
How to Configure Operations Types in Odoo 15How to Configure Operations Types in Odoo 15
How to Configure Operations Types in Odoo 15
 
Oracle Payables R12 ivas
Oracle Payables R12 ivasOracle Payables R12 ivas
Oracle Payables R12 ivas
 
Ebs ecc-quick-start-guide
Ebs ecc-quick-start-guideEbs ecc-quick-start-guide
Ebs ecc-quick-start-guide
 
Fujcci crp oracle payroll
Fujcci crp oracle payrollFujcci crp oracle payroll
Fujcci crp oracle payroll
 
Oracle Apps - Forms
Oracle Apps - FormsOracle Apps - Forms
Oracle Apps - Forms
 
Object Relation Mapping in Odoo 16
Object Relation Mapping in Odoo 16Object Relation Mapping in Odoo 16
Object Relation Mapping in Odoo 16
 
8 legal structures
8   legal structures8   legal structures
8 legal structures
 
Hr profile option
Hr profile optionHr profile option
Hr profile option
 
R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)R12:Payment Process Request (PPR)
R12:Payment Process Request (PPR)
 
Oracle Receivables R12
Oracle Receivables R12Oracle Receivables R12
Oracle Receivables R12
 
Oracle R12 Multi org ivas
Oracle R12 Multi org ivasOracle R12 Multi org ivas
Oracle R12 Multi org ivas
 
IntegrationBroker
IntegrationBrokerIntegrationBroker
IntegrationBroker
 
Validation type 'special' in value sets
Validation type 'special' in value setsValidation type 'special' in value sets
Validation type 'special' in value sets
 
Fast formula queries for functions, contexts, db is and packages
Fast formula queries for functions, contexts, db is and packagesFast formula queries for functions, contexts, db is and packages
Fast formula queries for functions, contexts, db is and packages
 
View Inheritance in Odoo 16
View Inheritance in Odoo 16View Inheritance in Odoo 16
View Inheritance in Odoo 16
 
Oracle General Ledger GL FSG
Oracle General Ledger GL FSG Oracle General Ledger GL FSG
Oracle General Ledger GL FSG
 
Oracle EBS R12 Sales order personalization
Oracle EBS R12 Sales order personalizationOracle EBS R12 Sales order personalization
Oracle EBS R12 Sales order personalization
 
Oracle Fixed assets ivas
Oracle Fixed assets ivasOracle Fixed assets ivas
Oracle Fixed assets ivas
 
Upgrading 11i E-business Suite to R12 E-business Suite
Upgrading 11i E-business Suite to R12 E-business SuiteUpgrading 11i E-business Suite to R12 E-business Suite
Upgrading 11i E-business Suite to R12 E-business Suite
 

Similar to Model Constraints - SQL Constraints Odoo 16

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
 
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
 
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/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
 
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
Mukesh Tekwani
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 
Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020
Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020
Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020
DmitryLenev
 

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
 
Oracle SQL Fundamentals - Lecture 3
Oracle SQL Fundamentals - Lecture 3Oracle SQL Fundamentals - Lecture 3
Oracle SQL Fundamentals - Lecture 3
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Sql commands
Sql commandsSql commands
Sql commands
 
1.Implementing_Data_Integrity.pdf
1.Implementing_Data_Integrity.pdf1.Implementing_Data_Integrity.pdf
1.Implementing_Data_Integrity.pdf
 
Bn1017 a demo rdbms
Bn1017 a demo  rdbmsBn1017 a demo  rdbms
Bn1017 a demo rdbms
 
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)
 
Sql integrity constraints
Sql integrity constraintsSql integrity constraints
Sql integrity constraints
 
Entigrity constraint
Entigrity constraintEntigrity constraint
Entigrity constraint
 
Oracle SQL Part 2
Oracle SQL Part 2Oracle SQL Part 2
Oracle SQL Part 2
 
RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)RDBMS Lab03 applying constraints (UIU)
RDBMS Lab03 applying constraints (UIU)
 
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
 
Bn1037 demo oracle sql
Bn1037 demo  oracle sqlBn1037 demo  oracle sql
Bn1037 demo oracle sql
 
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
 
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
 
Database constraints
Database constraintsDatabase constraints
Database constraints
 
Dms 22319 micro project
Dms 22319 micro projectDms 22319 micro project
Dms 22319 micro project
 
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020
Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020
Check Constraints in MySQL 8.0. Presented at pre-FOSDEM MySQL Day 2020
 

More from Celine George

Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
Celine George
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
Celine George
 
Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17
Celine George
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
Celine George
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
Celine George
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
Celine George
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 

More from Celine George (20)

Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
 
Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
Nguyen Thanh Tu Collection
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
Payaamvohra1
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 

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.