use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method generateViewSaleOrder.
@SuppressWarnings("unchecked")
public void generateViewSaleOrder(ActionRequest request, ActionResponse response) {
LinkedHashMap<String, Object> saleOrderTemplateContext = (LinkedHashMap<String, Object>) request.getContext().get("_saleOrderTemplate");
Integer saleOrderId = (Integer) saleOrderTemplateContext.get("id");
SaleOrder context = Beans.get(SaleOrderRepository.class).find(Long.valueOf(saleOrderId));
response.setView(ActionView.define("Sale order").model(SaleOrder.class.getName()).add("form", "sale-order-form-wizard").context("_idCopy", context.getId().toString()).context("_wizardCurrency", request.getContext().get("currency")).context("_wizardPriceList", request.getContext().get("priceList")).map());
response.setCanClose(true);
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method enableEditOrder.
public void enableEditOrder(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = Beans.get(SaleOrderRepository.class).find(request.getContext().asType(SaleOrder.class).getId());
try {
boolean checkAvailabiltyRequest = Beans.get(SaleOrderService.class).enableEditOrder(saleOrder);
response.setReload(true);
if (checkAvailabiltyRequest) {
response.setNotify(I18n.get(IExceptionMessage.SALE_ORDER_EDIT_ORDER_NOTIFY));
}
} 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 completeSaleOrder.
public void completeSaleOrder(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
saleOrder = Beans.get(SaleOrderRepository.class).find(saleOrder.getId());
try {
Beans.get(SaleOrderWorkflowServiceImpl.class).completeSaleOrder(saleOrder);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
response.setReload(true);
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method getSaleOrderPartnerDomain.
public void getSaleOrderPartnerDomain(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
Company company = saleOrder.getCompany();
Long companyPartnerId = company.getPartner() == null ? 0 : company.getPartner().getId();
String domain = String.format("self.id != %d AND self.isContact = false AND (self.isCustomer = true or self.isProspect = true)", companyPartnerId);
domain += " AND :company member of self.companySet";
try {
if (!(saleOrder.getSaleOrderLineList() == null || saleOrder.getSaleOrderLineList().isEmpty())) {
domain += Beans.get(PartnerService.class).getPartnerDomain(saleOrder.getClientPartner());
}
} catch (Exception e) {
TraceBackService.trace(e);
response.setError(e.getMessage());
}
response.setAttr("clientPartner", "domain", domain);
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method finalizeQuotation.
public void finalizeQuotation(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
saleOrder = Beans.get(SaleOrderRepository.class).find(saleOrder.getId());
try {
Beans.get(SaleOrderWorkflowService.class).finalizeQuotation(saleOrder);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
response.setReload(true);
}
Aggregations