erratic behavior with context variables set on callouts

Description

Hi, I found a big issue with callouts setting variables in context and depending on those variable to effect the business logic. The problem is that when you change an existing record and leave some field untouched the behavior became erratic.

Practical example:

Create a new order, select C&W Construction as business partner, save. Add a line with product pchair, put 1 into quantity and change the price to 28.00. Save and logout. Log back in search the order and go straight to the line, change the quantity to 2 and look at the price, it will change also! This is because of the callout org.compiere.model.CalloutOrder.amt(Properties, int, GridTab, GridField, Object) which at some point do the following test:

// Product Qty changed - recalc price
else if ((mField.getColumnName().equals("QtyOrdered")

mField.getColumnName().equals("QtyEntered")

mField.getColumnName().equals("M_Product_ID"))

&& !"N".equals(Env.getContext(ctx, WindowNo, "DiscountSchema")))

here the variable DiscountSchema is not set because the product is not changed and the callout is not called, so the test is true and the price get changed.

This is just an example, there are many variables which are not set unless the user change specific fields but are then tested for other fields both into callouts and on mandatory/display/readonly logic. For instance in the order there are OrderType, HasCharges, EnforcePriceLimit etc

Another example: I tried to set the price as 20.00 on a new record, and it gave me an error because it was under the price limit of 27.00, so I put 28.00. But after logging out and back in, I was able to set it to 20.00 and complete!

I think this is a serious bug which could lead to any kind of oddities

Regards,
Angelo

Environment

None

Assignee

Michael McKay

Reporter

Angelo DabalĂ 

Labels

Components

Affects versions

Priority

Critical
Configure