use of com.axelor.apps.purchase.db.repo.PurchaseOrderLineRepository in project axelor-open-suite by axelor.
the class PurchaseOrderLineProjectController method updateToInvoice.
/**
* Invert value of 'toInvoice' field and save the record
*
* @param request
* @param response
*/
@Transactional
public void updateToInvoice(ActionRequest request, ActionResponse response) {
PurchaseOrderLineRepository purchaseOrderLineRepository = Beans.get(PurchaseOrderLineRepository.class);
try {
PurchaseOrderLine purchaseOrderLine = request.getContext().asType(PurchaseOrderLine.class);
purchaseOrderLine = purchaseOrderLineRepository.find(purchaseOrderLine.getId());
purchaseOrderLine.setToInvoice(!purchaseOrderLine.getToInvoice());
purchaseOrderLineRepository.save(purchaseOrderLine);
response.setValue("toInvoice", purchaseOrderLine.getToInvoice());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations