Error of the [Products] detail of the order

Case

When I click "Add" on the [Products] detail in an order, I get an error that the total payment sum per order does not correspond the sum of products.

The same happens when I do it for the installment plan.

Answer

When you add a product, bpm'online saves the page. Though the "OrderStatus" base lookup has been changed in this case. During saving, the system checks the correspondence of the sums and the OrderPageV2 page code of the Passport package fails:

validateOrderStatus: function(callback, scope) {
    var result = {
        success: true
    };
    var status = this.get("Status");
    var primaryAmount = this.get("PrimaryAmount");
    var OrderStatus = OrderConfigurationConstants.Order.OrderStatus;
    if (status && (status.value === OrderStatus.InPlanned || status.value === OrderStatus.Canceled)) {
        callback.call(scope || this, result);
        return;
    }
    var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
        rootSchemaName: "SupplyPaymentElement"
    });
    esq.addAggregationSchemaColumn("PrimaryAmountPlan", Terrasoft.AggregationType.SUM,
"PrimaryAmountPlanSum");
    var filters = Terrasoft.createFilterGroup();
    filters.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,
"Order", this.get("Id")));
    filters.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,
"Type", OrderConfigurationConstants.SupplyPaymentElement.Type.Payment));
    esq.filters = filters;
    esq.getEntityCollection(function(response) {
        if (response.success) {
            var collection = response.collection;
            if (collection.getCount() > 0 && primaryAmount !==
collection.getByIndex(0).get("PrimaryAmountPlanSum")) {
                result.message = this.get("Resources.Strings.ValidateOrderStatus");
                result.success = false;
            }
        } else {
            return;
        }
        callback.call(this, result);
    }, scope);

Instruction

var status = this.get("Status"); - returns undefined

collection.getByIndex(0).get("PrimaryAmountPlanSum"))  - returns 0

This causes the verification failure and provides notifications for the "Planned" status.

To solve the issue, replace the OrderConfigurationConstant module and specify the correct Ids in it. This way, the below code:

if (status && (status.value === OrderStatus.InPlanned || status.value === OrderStatus.Canceled)) {
    callback.call(scope || this, result);
    return;
}

will be performed successfully.

 

Like 0

Like

Share

0 comments
Show all comments