use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method computeAddressStr.
/**
* Set the address string with their values.
*
* @param request
* @param response
*/
public void computeAddressStr(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
Beans.get(SaleOrderService.class).computeAddressStr(saleOrder);
response.setValues(saleOrder);
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method computeMargin.
public void computeMargin(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
try {
Beans.get(SaleOrderMarginService.class).computeMarginSaleOrder(saleOrder);
response.setValue("accountedRevenue", saleOrder.getAccountedRevenue());
response.setValue("totalCostPrice", saleOrder.getTotalCostPrice());
response.setValue("totalGrossMargin", saleOrder.getTotalGrossMargin());
response.setValue("marginRate", saleOrder.getMarginRate());
response.setValue("markup", saleOrder.getMarkup());
} 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 fillCompanyBankDetails.
/**
* Called on partner, company or payment change. Fill the bank details with a default value.
*
* @param request
* @param response
* @throws AxelorException
*/
public void fillCompanyBankDetails(ActionRequest request, ActionResponse response) throws AxelorException {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
PaymentMode paymentMode = (PaymentMode) request.getContext().get("paymentMode");
Company company = saleOrder.getCompany();
Partner partner = saleOrder.getClientPartner();
if (company == null) {
return;
}
if (partner != null) {
partner = Beans.get(PartnerRepository.class).find(partner.getId());
}
BankDetails defaultBankDetails = Beans.get(BankDetailsService.class).getDefaultCompanyBankDetails(company, paymentMode, partner, null);
response.setValue("companyBankDetails", defaultBankDetails);
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method filterPrintingSettings.
/**
* Called on printing settings select. Set the domain for {@link SaleOrder#printingSettings}
*
* @param request
* @param response
*/
public void filterPrintingSettings(ActionRequest request, ActionResponse response) {
try {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
List<PrintingSettings> printingSettingsList = Beans.get(TradingNameService.class).getPrintingSettingsList(saleOrder.getTradingName(), saleOrder.getCompany());
String domain = String.format("self.id IN (%s)", !printingSettingsList.isEmpty() ? StringTool.getIdListString(printingSettingsList) : "0");
response.setAttr("printingSettings", "domain", domain);
} 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 confirmSaleOrder.
public void confirmSaleOrder(ActionRequest request, ActionResponse response) {
try {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
Beans.get(SaleOrderWorkflowService.class).confirmSaleOrder(Beans.get(SaleOrderRepository.class).find(saleOrder.getId()));
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations