use of com.axelor.apps.production.service.costsheet.CostSheetService in project axelor-open-suite by axelor.
the class ManufOrderController method computeCostPrice.
/**
* Called from manuf order form, on clicking "compute cost price" button. Call {@link
* CostSheetService#computeCostPrice(ManufOrder, int, LocalDate)}.
*
* @param request
* @param response
*/
public void computeCostPrice(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
CostSheet costSheet = Beans.get(CostSheetService.class).computeCostPrice(manufOrder, CostSheetRepository.CALCULATION_WORK_IN_PROGRESS, Beans.get(AppBaseService.class).getTodayDate(manufOrder.getCompany()));
response.setView(ActionView.define(I18n.get("Cost sheet")).model(CostSheet.class.getName()).param("popup", "true").param("show-toolbar", "false").param("show-confirm", "false").param("popup-save", "false").add("grid", "cost-sheet-bill-of-material-grid").add("form", "cost-sheet-bill-of-material-form").context("_showRecord", String.valueOf(costSheet.getId())).map());
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations