_sql_constraints Odoo, PostgreSQL Constraints, How to add sql constraints in Odoo, Model Constraints

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

ความคิดเห็น • 4

  • @info-tech-baba4890
    @info-tech-baba4890 3 ปีที่แล้ว +2

    Nice one, Is it possible to add Odoo level constraint and if yes how ?

    • @Weblearns
      @Weblearns  3 ปีที่แล้ว +2

      Yes it is possible using odoo constraint, Soon you will get this discussion too.
      Stay with us.
      By the way thanks you shared playlist in your account :)
      Keep sharing such amazing topics to this world :)
      Thank You

  • @HienNguyen-lz9tw
    @HienNguyen-lz9tw 3 ปีที่แล้ว

    Hi guy, can we remove an existing sql_constraint when inheriting a model?

    • @Weblearns
      @Weblearns  3 ปีที่แล้ว +1

      By default Odoo don't have option to remove sql constraint directly. So here you have to follow any of below option.
      1) Find that sql constraint name and remove from postgres database directly.
      2) Create new module and here inherit the same model and try to override that sql constraint like this.
      _sql_constraints = [('your_sql_constraint_name', 'CHECK(1=1)', 'Override this constraint to by pass previous logic!')]