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