use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.
the class BillOfMaterialController method computeCostPrice.
public void computeCostPrice(ActionRequest request, ActionResponse response) throws AxelorException {
BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
CostSheet costSheet = Beans.get(CostSheetService.class).computeCostPrice(Beans.get(BillOfMaterialRepository.class).find(billOfMaterial.getId()), CostSheetService.ORIGIN_BILL_OF_MATERIAL, null);
response.setView(ActionView.define(String.format(I18n.get("Cost sheet - %s"), billOfMaterial.getName())).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);
}
use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.
the class BillOfMaterialController method generateNewVersion.
public void generateNewVersion(ActionRequest request, ActionResponse response) {
BillOfMaterial billOfMaterial = Beans.get(BillOfMaterialRepository.class).find(request.getContext().asType(BillOfMaterial.class).getId());
BillOfMaterial copy = Beans.get(BillOfMaterialService.class).generateNewVersion(billOfMaterial);
response.setView(ActionView.define("Bill of materials").model(BillOfMaterial.class.getName()).add("form", "bill-of-material-form").add("grid", "bill-of-material-grid").param("search-filters", "bill-of-material-filters").domain("self.defineSubBillOfMaterial = true AND self.personalized = false").context("_showRecord", String.valueOf(copy.getId())).map());
}
use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.
the class BillOfMaterialController method setBillOfMaterialAsDefault.
public void setBillOfMaterialAsDefault(ActionRequest request, ActionResponse response) {
try {
BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
billOfMaterial = Beans.get(BillOfMaterialRepository.class).find(billOfMaterial.getId());
Beans.get(BillOfMaterialService.class).setBillOfMaterialAsDefault(billOfMaterial);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(e);
}
}
use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.
the class BillOfMaterialController method print.
public void print(ActionRequest request, ActionResponse response) throws AxelorException {
BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
BillOfMaterialService billOfMaterialService = Beans.get(BillOfMaterialService.class);
String language = ReportSettings.getPrintingLocale(null);
String name = billOfMaterialService.getFileName(billOfMaterial);
String fileLink = billOfMaterialService.getReportLink(billOfMaterial, name, language, ReportSettings.FORMAT_PDF);
LOG.debug("Printing " + name);
response.setView(ActionView.define(name).add("html", fileLink).map());
}
use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.
the class BillOfMaterialController method openBomTree.
public void openBomTree(ActionRequest request, ActionResponse response) {
BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
billOfMaterial = Beans.get(BillOfMaterialRepository.class).find(billOfMaterial.getId());
TempBomTree tempBomTree = Beans.get(BillOfMaterialService.class).generateTree(billOfMaterial, false);
response.setView(ActionView.define(I18n.get("Bill of materials")).model(TempBomTree.class.getName()).add("tree", "bill-of-material-tree").context("_tempBomTreeId", tempBomTree.getId()).map());
}
Aggregations