use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderCreateServiceImpl method createTemplate.
@Override
@Transactional
public SaleOrder createTemplate(SaleOrder context) {
SaleOrder copy = saleOrderRepo.copy(context, true);
copy.setTemplate(true);
copy.setTemplateUser(AuthUtils.getUser());
return copy;
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderCreateServiceImpl method createSaleOrder.
@Override
@Transactional(rollbackOn = { Exception.class })
public SaleOrder createSaleOrder(SaleOrder context, Currency wizardCurrency, PriceList wizardPriceList) throws AxelorException {
SaleOrder copy = saleOrderRepo.copy(context, true);
copy.setCreationDate(appSaleService.getTodayDate(context.getCompany()));
copy.setCurrency(wizardCurrency);
copy.setPriceList(wizardPriceList);
saleOrderService.computeEndOfValidityDate(copy);
this.updateSaleOrderLineList(copy);
saleOrderComputeService.computeSaleOrder(copy);
copy.setTemplate(false);
copy.setTemplateUser(null);
return copy;
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method fillSaleOrderLinesEstimatedDate.
public void fillSaleOrderLinesEstimatedDate(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
List<SaleOrderLine> saleOrderLineList = saleOrder.getSaleOrderLineList();
if (saleOrderLineList != null) {
for (SaleOrderLine saleOrderLine : saleOrderLineList) {
Integer deliveryState = saleOrderLine.getDeliveryState();
if (!deliveryState.equals(SaleOrderLineRepository.DELIVERY_STATE_DELIVERED) && !deliveryState.equals(SaleOrderLineRepository.DELIVERY_STATE_PARTIALLY_DELIVERED)) {
saleOrderLine.setEstimatedDelivDate(saleOrder.getDeliveryDate());
}
}
}
response.setValue("saleOrderLineList", saleOrderLineList);
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method deallocateAll.
/**
* Called from the toolbar in sale order form view. Call {@link
* com.axelor.apps.supplychain.service.SaleOrderReservedQtyService#deallocateAll(SaleOrder)}.
*
* @param request
* @param response
*/
public void deallocateAll(ActionRequest request, ActionResponse response) {
try {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
saleOrder = Beans.get(SaleOrderRepository.class).find(saleOrder.getId());
Beans.get(SaleOrderReservedQtyService.class).deallocateAll(saleOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method cancelReservation.
/**
* Called from the toolbar in sale order form view. Call {@link
* com.axelor.apps.supplychain.service.SaleOrderReservedQtyService#cancelReservation(SaleOrder)}.
*
* @param request
* @param response
*/
public void cancelReservation(ActionRequest request, ActionResponse response) {
try {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
saleOrder = Beans.get(SaleOrderRepository.class).find(saleOrder.getId());
Beans.get(SaleOrderReservedQtyService.class).cancelReservation(saleOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations