Search in sources :

Example 1 with ProductCategoryService

use of com.axelor.apps.base.service.ProductCategoryService in project axelor-open-suite by axelor.

the class ProductCategoryController method showExistingDiscounts.

/**
 * Called from product category view on maxDiscount change. Call {@link
 * ProductCategoryService#computeDiscountMessage(ProductCategory)}.
 *
 * @param request
 * @param response
 */
public void showExistingDiscounts(ActionRequest request, ActionResponse response) {
    try {
        ProductCategory productCategory = request.getContext().asType(ProductCategory.class);
        String discountsMessage = Beans.get(ProductCategoryService.class).computeDiscountMessage(productCategory);
        if (!"".equals(discountsMessage)) {
            response.setFlash(discountsMessage);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ProductCategory(com.axelor.apps.base.db.ProductCategory) ProductCategoryService(com.axelor.apps.base.service.ProductCategoryService)

Aggregations

ProductCategory (com.axelor.apps.base.db.ProductCategory)1 ProductCategoryService (com.axelor.apps.base.service.ProductCategoryService)1