← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 733252] Re: osv/fields: required fields shall have ondelete="restrict" by default

 

** Changed in: openobject-server
   Importance: Undecided => Wishlist

** Changed in: openobject-server
    Milestone: None => 6.1

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/733252

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

Status in OpenERP Server:
  Fix Committed

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".



References