The company that will be using OFBiz needs to be able to add items to an order after some payments have been received. Does anyone know if this functionality is supported yet? The error I've encountered with the operation so far is:

Generic Entity Exception occured in deleteByCondition (SQL Exception while executing the following:DELETE FROM public.ORDER_ADJUSTMENT WHERE (ORDER_ID = 'WSCO10160' AND (ORDER_ADJUSTMENT_TYPE_ID = 'PROMOTION_ADJUSTMENT' OR ORDER_ADJUSTMENT_TYPE_ID = 'SHIPPING_CHARGES' OR ORDER_ADJUSTMENT_TYPE_ID = 'SALES_TAX' OR ORDER_ADJUSTMENT_TYPE_ID = 'VAT_TAX' OR ORDER_ADJUSTMENT_TYPE_ID = 'VAT_PRICE_CORRECT')) (ERROR: update or delete on table "order_adjustment" violates foreign key constraint "order_adjblng_oa" on table "order_adjustment_billing"<br/> Detail: Key (order_adjustment_id)=(10815) is still referenced from table "order_adjustment_billing".))

This is caused by these lines in OrderServices.loadCartForUpdate:
List<EntityCondition> adjExprs = new LinkedList<EntityCondition>(); adjExprs.add(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId)); List<EntityCondition> exprs = new LinkedList<EntityCondition>(); exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "PROMOTION_ADJUSTMENT")); exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "SHIPPING_CHARGES")); exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "SALES_TAX")); exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "VAT_TAX")); exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "VAT_PRICE_CORRECT")); adjExprs.add(EntityCondition.makeCondition(exprs, EntityOperator.OR)); EntityCondition cond = EntityCondition.makeCondition(adjExprs, EntityOperator.AND);
            delegator.removeByCondition("OrderAdjustment", cond);

order_adjustment_billing depends on the order_adjustment table so it seems the records should not be deleted.

For a scenario where 2 items were ordered during a promo and 1 item was added after the promo ended after 1 payment had already been recieved, some sort of date checking logic would have to be implemented to look at order_item_change change_date and compare with the order_adjustment created_date.

Anyone ever faced a similar problem or have recommendations?

Reply via email to