There is this seca: -eca service="changeOrderStatus" event="commit" run-on-error="false"- -condition field-name="orderTypeId" operator="equals" value="PURCHASE_ORDER"- -condition field-name="statusId" operator="equals" value="ORDER_APPROVED"- -condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId/- -action service="createPaymentFromOrder" mode="sync" persist="true"- -eca-
If the order is approved and it is a purchase order, the service createPaymentFromOrder is called which creates a payment and a OrderPaymentPreference amoung other things. This is causing me some problems because when the order is received, an invoice is created by InvoiceServices.createInvoiceForOrder and around line 776 is this line: List<GenericValue> orderPaymentPrefs = delegator.findList("OrderPaymentPreference", EntityCondition.makeCondition(paymentPrefConds, EntityOperator.AND), null, null, null, false); This returns the above created OrderPaymentPreference and a PaymentApplication is created for the payment created above. There is a bug in this code that miscalculates the amount to apply and I get errors like: Error in service [createPaymentApplication] Tried to apply [692.5] which is greater than the outstanding amount [623.25] of invoice [62741]. Now, I dont really care about this bug. In my view, the Payment and OrderPaymentPreference should not have been created. In version 9.x, this seca did not exist. My question is what is the purpose? No payment was ever received, it is a completely bogus one. I have commented out the seca and am in the process of writing a service to remove all the payments, applications, and OrderPaymentPreference created by the above seca. I am just wondering what the logic here was. Skip