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
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.
Hi,
We don't have to drop the constraint but just adding the "ON DELETE SET NULL" clause should resolve the error.
Regards,
Low
hi
i it feasible to modify "linkorderline_corderline" constraint to "ON DELETE SET NULL".
Regards
Faisal Shahzad
VOSS Com
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
Thanks a lot Tobi.
Committed revision 9918
http://adempiere.svn.sourceforge.net/adempiere/?rev=9918&view=rev
Regards,
Carlos Ruiz
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).