Menu

#1919 Cannot delete line on PO generated from SO

Core
closed-accepted
Order (PO) (22)
9
2009-08-28
2009-05-28
Carlos Ruiz
No

Thanks to Shiju01 for reporting here:
https://sourceforge.net/forum/message.php?msg_id=7413770

Test case checked in http://www.testadempiere.com/webui

Create a Sales Order with this info:
* BP = Patio
* DocType = Standard Order
Lines:
* 1 Weeder
* 1 Hoe

Complete it

Then execute the "Generate PO from Sales Order" process.

Try to delete one line of the generated purchase order.
This error is shown to user:

Database Error.
ORA-02292: integrity constraint (ADEMPIERE.LINKORDERLINE_CORDERLINE) violated - child record found

1 - database errors must not be shown to end user - they must be caught and shown a proper message
2 - maybe a beforeDelete trigger on C_OrderLine to break the link between the sales order line and purchase order line can solve the problem? (I suppose it depends on the usage of link order line)

Dirty workaround -> Qty=0 instead of delete

Regards,

Carlos Ruiz

Discussion

  • Muhammad Faisal Shahzad

    hi,
    if we want to allow the user to delete an item from the PO generated from SO then we should have to drop "inkorderline_corderlin" constrain from "c_orderline" table of the DB but a deletion conformation dialog box should be shown before delete.

    Give your comments on my suggestion.

     
  • Heng Sin

    Heng Sin - 2009-06-02

    Hi,

    We don't have to drop the constraint but just adding the "ON DELETE SET NULL" clause should resolve the error.

    Regards,
    Low

     
  • Muhammad Faisal Shahzad

    hi
    i it feasible to modify "linkorderline_corderline" constraint to "ON DELETE SET NULL".

    Regards
    Faisal Shahzad
    VOSS Com

     
  • Tobias Schöneberg

    Hi,
    in postgres the constraint could be modified like this:

    ALTER TABLE adempiere.c_orderline DROP CONSTRAINT linkorderline_corderline;

    ALTER TABLE adempiere.c_orderline
    ADD CONSTRAINT linkorderline_corderline FOREIGN KEY (link_orderline_id)
    REFERENCES adempiere.c_orderline (c_orderline_id) MATCH SIMPLE
    ON UPDATE NO ACTION ON DELETE SET NULL;

    Can anybody provide oracle (or maybe a shorter postgres one)?

    Regards
    tobi

     
  • Carlos Ruiz

    Carlos Ruiz - 2009-08-13
    • assigned_to: nobody --> globalqss
    • status: open --> pending-accepted
     
  • SourceForge Robot

    • status: pending-accepted --> closed-accepted
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

MongoDB Logo MongoDB