osv/fields: required fields shall have ondelete="restrict" by default

Bug #733252 reported by xrg
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Committed
Wishlist
xrg

Bug Description

Required fields have the set NOT NULL attribute. This cannot work together
with ON DELETE SET NULL behaviour for their referenced records. The
safest default seems to be ON DELETE RESTRICT.
Example: account.invoice:partner_id, which has to restrict deleting a
partner when there is any invoices linked to him/her.
This merely improves the SQL messages, from:
  IntegrityError: null value in column "partner_id" violates not-null constraint
  CONTEXT: SQL statement "UPDATE ONLY "public"."account_invoice" SET "partner_id" = NULL
      WHERE $1 OPERATOR(pg_catalog.=) "partner_id""
to:
  IntegrityError: update or delete on table "res_partner" violates foreign key
     constraint "account_invoice_partner_id_fkey" on table "account_invoice"
  DETAIL: Key (id)=(7) is still referenced from table "account_invoice".

Tags: fields

Related branches

xrg (xrg)
Changed in openobject-server:
assignee: nobody → xrg (xrg)
status: New → In Progress
xrg (xrg)
Changed in openobject-server:
status: In Progress → Fix Committed
Changed in openobject-server:
importance: Undecided → Wishlist
milestone: none → 6.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.