use of com.axelor.apps.purchase.db.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderLineController method convertUnitPrice.
public void convertUnitPrice(ActionRequest request, ActionResponse response) {
Context context = request.getContext();
PurchaseOrderLine purchaseOrderLine = context.asType(PurchaseOrderLine.class);
PurchaseOrder purchaseOrder = this.getPurchaseOrder(context);
if (purchaseOrder == null || purchaseOrderLine.getProduct() == null || purchaseOrderLine.getPrice() == null || purchaseOrderLine.getInTaxPrice() == null || purchaseOrderLine.getTaxLine() == null) {
return;
}
try {
BigDecimal price = purchaseOrderLine.getPrice();
BigDecimal inTaxPrice = price.add(price.multiply(purchaseOrderLine.getTaxLine().getValue()));
response.setValue("inTaxPrice", inTaxPrice);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderLineController method getProductInformation.
public void getProductInformation(ActionRequest request, ActionResponse response) {
try {
PurchaseOrderLineService service = Beans.get(PurchaseOrderLineService.class);
Context context = request.getContext();
PurchaseOrderLine purchaseOrderLine = context.asType(PurchaseOrderLine.class);
PurchaseOrder purchaseOrder = this.getPurchaseOrder(context);
Product product = purchaseOrderLine.getProduct();
this.resetProductInformation(response);
response.setValues(service.reset(purchaseOrderLine));
if (purchaseOrder == null || product == null) {
return;
}
purchaseOrderLine.setPurchaseOrder(purchaseOrder);
service.fill(purchaseOrderLine, purchaseOrder);
response.setValues(purchaseOrderLine);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrder 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.PurchaseOrder 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.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderController method cancelReceipt.
public void cancelReceipt(ActionRequest request, ActionResponse response) throws AxelorException {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(purchaseOrder.getId());
Beans.get(PurchaseOrderStockServiceImpl.class).cancelReceipt(purchaseOrder);
}
Aggregations