Error when cancelling line items after completing other line items, order adjustment errors - r470162
----------------------------------------------------------------------------------------------------- Key: OFBIZ-461 URL: http://issues.apache.org/jira/browse/OFBIZ-461 Project: OFBiz (The Open for Business Project) Issue Type: Bug Components: order Affects Versions: SVN trunk Environment: N/A Reporter: Ray Barlow Si, Looks like r470162 has caused this problem. Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. Click on the "Edit Items" and then "Cancel" the GZ-1001. This is the error message: Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=all ]
Si Chen reassigned OFBIZ-461: ----------------------------- Assignee: Si Chen > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=comments#action_12450116 ]
Chris Liberty commented on OFBIZ-461: ------------------------------------- The problem seems to be that when an order item is cancelled, the entire tax context for the order (item tax and header tax) is blindly destroyed and recalculated, regardless that some order items may already have been invoiced. The guilty party is OrderServices.recalcOrderTax() line 1233. The new relation to OrderAdjustmentBilling exposes the problem by preventing the deletion of OrderAdjustment records which are related to invoices. So the question is - what to do about it? The obvious answer is to destroy and recreate only those tax adjustments which haven't yet been billed (aren't related to an OrderAdjustmentBilling record), but that raises the question of what to do with header-level taxes. If ProductStore.prorateTaxes is set to N, then all the header-level taxes will have been billed, and recalculating taxes after cancelling an order item would have no effect on header-level taxes. Conversely, if ProductStore.prorateTaxes is set to Y, then a portion of header-level taxes will have been billed, and what do we do then? Should we recalculate the taxes normally and then subtract any pro-rated header-level taxes already billed? > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=comments#action_12450133 ]
Si Chen commented on OFBIZ-461: ------------------------------- That code which removes all the OrderAdjustment records always gave me a fright, so my suggestion is this: Instead of removing all the OrderAdjustment records, recalculate the tax total, and then just add a new OrderAdjustment which can be positive or negative with the tagline "Tax adjustment due to order change" and add it in. Anybody else have an opinion? > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=comments#action_12450136 ]
Jacopo Cappellato commented on OFBIZ-461: ----------------------------------------- Si, it makes sense. The code that handles the editing of an existing order has always frighten me too... soonel or later we'll have to consider some serious refactoring or at least heavy testing the whole stuff; the (upcoming?) automated testing framework could probably help a lot in this area... > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=comments#action_12450172 ]
Jacques Le Roux commented on OFBIZ-461: --------------------------------------- Si, This seems a good idea to me too (only on a functionnal POV, I don't know much about recalcOrderTax) > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=all ]
Chris Liberty updated OFBIZ-461: -------------------------------- Attachment: OFBIZ-461_1.patch.zip Patch modifies recalcTaxTotal service ( OrderServices.recalcOrderTax() ) to create an OrderAdjustment reflecting sales tax adjustment changes for an order after order item cancellation, and modifies recreateOrderAdjustments service ( in OrderServices.xml ) to do the same for promotion adjustments. This replaces the previous method of destroying and reconstructing OrderAdjustments. > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > Attachments: OFBIZ-461_1.patch.zip > > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=comments#action_12451100 ]
Si Chen commented on OFBIZ-461: ------------------------------- Ray, can you take a look at this and let me know if it solves your problem? > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > Attachments: OFBIZ-461_1.patch.zip > > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=comments#action_12451101 ]
Si Chen commented on OFBIZ-461: ------------------------------- This version seems to fix the problem. Let me know if you still have problems. > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > Attachments: OFBIZ-461_1.patch.zip > > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=comments#action_12451601 ]
Ray Barlow commented on OFBIZ-461: ---------------------------------- Chris and Si, Thanks the patch looks good and fixes the problem. > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > Attachments: OFBIZ-461_1.patch.zip > > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ http://issues.apache.org/jira/browse/OFBIZ-461?page=all ]
Si Chen closed OFBIZ-461. ------------------------- Resolution: Fixed > Error when cancelling line items after completing other line items, order adjustment errors - r470162 > ----------------------------------------------------------------------------------------------------- > > Key: OFBIZ-461 > URL: http://issues.apache.org/jira/browse/OFBIZ-461 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: order > Affects Versions: SVN trunk > Environment: N/A > Reporter: Ray Barlow > Assigned To: Si Chen > Attachments: OFBIZ-461_1.patch.zip > > > Si, > Looks like r470162 has caused this problem. > Create a new order and add two products GZ-1000 and GZ-1001 and then approve the new order. > Click on "Pack Shipment For Ship Group [00001]" and ensure you only pack and complete the product GZ-1000. > Viewing the order again you should have an invoice for the part shipment and the outstanding GZ-1001 still in the approved state. > Click on the "Edit Items" and then "Cancel" the GZ-1001. > This is the error message: > Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Exception while deleting the following entity: [GenericEntity:OrderAdjustment][orderAdjustmentId,10003(java.lang.String)] (SQL Exception while executing the following:DELETE FROM OFBIZ.ORDER_ADJUSTMENT WHERE ORDER_ADJUSTMENT_ID=? (DELETE on table 'ORDER_ADJUSTMENT' caused a violation of foreign key constraint 'ORDER_ADJBLNG_OA' for key (10003). The statement has been rolled back.))) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
Free forum by Nabble | Edit this page |