use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderLineController method emptyLine.
public void emptyLine(ActionRequest request, ActionResponse response) {
try {
PurchaseOrderLine purchaseOrderLine = request.getContext().asType(PurchaseOrderLine.class);
if (purchaseOrderLine.getIsTitleLine()) {
PurchaseOrderLine newPurchaseOrderLine = new PurchaseOrderLine();
newPurchaseOrderLine.setIsTitleLine(true);
newPurchaseOrderLine.setQty(BigDecimal.ZERO);
newPurchaseOrderLine.setId(purchaseOrderLine.getId());
newPurchaseOrderLine.setVersion(purchaseOrderLine.getVersion());
response.setValues(Mapper.toMap(purchaseOrderLine));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderLineController method checkQty.
public void checkQty(ActionRequest request, ActionResponse response) {
try {
Context context = request.getContext();
PurchaseOrderLine purchaseOrderLine = context.asType(PurchaseOrderLine.class);
PurchaseOrder purchaseOrder = getPurchaseOrder(context);
PurchaseOrderLineService service = Beans.get(PurchaseOrderLineService.class);
service.checkMinQty(purchaseOrder, purchaseOrderLine, request, response);
service.checkMultipleQty(purchaseOrderLine, response);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderLineController method checkDifferentSupplier.
public void checkDifferentSupplier(ActionRequest request, ActionResponse response) {
try {
Context context = request.getContext();
PurchaseOrderLine purchaseOrderLine = context.asType(PurchaseOrderLine.class);
PurchaseOrder purchaseOrder = getPurchaseOrder(context);
PurchaseOrderLineService service = Beans.get(PurchaseOrderLineService.class);
service.checkDifferentSupplier(purchaseOrder, purchaseOrderLine, response);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderController method checkPurchaseOrderAnalyticDistributionTemplate.
/**
* Called from purchase order form view when validating purchase order and analytic distribution
* is required from company's purchase config.
*
* @param request
* @param response
*/
public void checkPurchaseOrderAnalyticDistributionTemplate(ActionRequest request, ActionResponse response) {
try {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
List<String> productList = new ArrayList<String>();
for (PurchaseOrderLine purchaseOrderLine : purchaseOrder.getPurchaseOrderLineList()) {
if (purchaseOrderLine.getAnalyticDistributionTemplate() == null) {
productList.add(purchaseOrderLine.getProduct().getFullName());
}
}
if (productList != null && !productList.isEmpty()) {
throw new AxelorException(TraceBackRepository.CATEGORY_MISSING_FIELD, I18n.get(IExceptionMessage.PURCHASE_ORDER_ANALYTIC_DISTRIBUTION_ERROR), productList);
}
} catch (AxelorException e) {
TraceBackService.trace(response, e, ResponseMessageType.ERROR);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrderLine in project axelor-open-suite by axelor.
the class PurchaseOrderLineController method computeBudgetDistributionSumAmount.
public void computeBudgetDistributionSumAmount(ActionRequest request, ActionResponse response) {
PurchaseOrderLine purchaseOrderLine = request.getContext().asType(PurchaseOrderLine.class);
PurchaseOrder purchaseOrder = request.getContext().getParent().asType(PurchaseOrder.class);
Beans.get(PurchaseOrderLineServiceSupplychainImpl.class).computeBudgetDistributionSumAmount(purchaseOrderLine, purchaseOrder);
response.setValue("budgetDistributionSumAmount", purchaseOrderLine.getBudgetDistributionSumAmount());
response.setValue("budgetDistributionList", purchaseOrderLine.getBudgetDistributionList());
}
Aggregations