May 8, 2024, 7:15 p.m. | Khaled Said

DEV Community dev.to

Inspired by


PostgreSQL exclusion constraints: Beyond UNIQUE by Hans-Jürgen Schönig

In Odoo platform you could apply model constraints in two methods. the first one is using SQL constraints and the second is using Python. Odoo provide Python constraints to give you the capability to apply checks on sophisticated logic.


An example of applying unique using SQL constraints in Odoo framework by adding _sql_constraints class attribute.



_sql_constraints = [
(
'code_company_uniq',
'unique (code,company_id)',
'The code of the account must be …

apply beyond capability checks constraints example gist hans logic odoo platform postgres postgresql python sql unique

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US