use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getAwaitingInvoicesOfUser.
@Override
public List<Filter> getAwaitingInvoicesOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, Invoice.class);
Filter filter = new JPQLFilter("self.partner.id = " + user.getPartner().getId() + " AND self.amountRemaining != 0 AND self.statusSelect != " + InvoiceRepository.STATUS_DRAFT + " AND self.statusSelect != " + InvoiceRepository.STATUS_CANCELED);
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getReversionsOfUser.
@Override
public List<Filter> getReversionsOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, StockMove.class);
Filter filter = new JPQLFilter("self.partner.id = " + user.getPartner().getId() + " AND self.typeSelect = " + StockMoveRepository.TYPE_OUTGOING + " AND self.isReversion = true");
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getOrdersInProgressOfUser.
/* SaleOrder Query */
@Override
public List<Filter> getOrdersInProgressOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, SaleOrder.class);
Filter filter = new JPQLFilter("self.clientPartner.id = " + user.getPartner().getId() + " AND self.statusSelect = " + SaleOrderRepository.STATUS_ORDER_CONFIRMED);
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getTotalRemainingOfUser.
@Override
public List<Filter> getTotalRemainingOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, Invoice.class);
Filter filter = new JPQLFilter("self.partner.id = " + user.getPartner().getId() + " AND self.amountRemaining != 0 AND self.statusSelect != " + InvoiceRepository.STATUS_DRAFT + " AND self.statusSelect != " + InvoiceRepository.STATUS_CANCELED);
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
use of com.axelor.rpc.filter.JPQLFilter in project axelor-open-suite by axelor.
the class ClientViewServiceImpl method getLastDeliveryOfUser.
/* StockMove Query */
@Override
public List<Filter> getLastDeliveryOfUser(User user) {
List<Filter> filters = new ArrayList<>();
Filter filterFromPermission = security.getFilter(JpaSecurity.CAN_READ, StockMove.class);
Filter filter = new JPQLFilter("self.partner.id = " + user.getPartner().getId() + " AND self.typeSelect = " + StockMoveRepository.TYPE_OUTGOING + " AND self.statusSelect = " + StockMoveRepository.STATUS_REALIZED + " AND self.isReversion != true");
if (user.getActiveCompany() != null) {
filter = Filter.and(filter, new JPQLFilter(" self.company.id = " + user.getActiveCompany().getId()));
}
if (filterFromPermission != null) {
filter = Filter.and(filter, filterFromPermission);
}
filters.add(filter);
addPermissionFilter(filters, filterFromPermission);
return filters;
}
Aggregations