use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method setDefaultInvoicedAndDeliveredPartnersAndAddresses.
public void setDefaultInvoicedAndDeliveredPartnersAndAddresses(ActionRequest request, ActionResponse response) {
try {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
Beans.get(SaleOrderSupplychainService.class).setDefaultInvoicedAndDeliveredPartnersAndAddresses(saleOrder);
response.setValues(saleOrder);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method changeWizardOperationDomain.
/**
* Called on sale order invoicing wizard form. Call {@link
* SaleOrderInvoiceService#getInvoicingWizardOperationDomain(SaleOrder)}
*
* @param request
* @param response
*/
public void changeWizardOperationDomain(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
List<Integer> operationSelectValues = Beans.get(SaleOrderInvoiceService.class).getInvoicingWizardOperationDomain(saleOrder);
response.setAttr("operationSelect", "value", operationSelectValues.stream().min(Integer::compareTo).orElse(null));
response.setAttr("operationSelect", "selection-in", operationSelectValues);
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method setDeliveredPartnerDomain.
/**
* Called from sale order form view, on delivered partner select. Call {@link
* PartnerSupplychainLinkService#computePartnerFilter}
*
* @param request
* @param response
*/
public void setDeliveredPartnerDomain(ActionRequest request, ActionResponse response) {
try {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
String strFilter = Beans.get(PartnerSupplychainLinkService.class).computePartnerFilter(saleOrder.getClientPartner(), PartnerSupplychainLinkTypeRepository.TYPE_SELECT_DELIVERED_BY);
response.setAttr("deliveredPartner", "domain", strFilter);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method updateAmountToBeSpreadOverTheTimetable.
public void updateAmountToBeSpreadOverTheTimetable(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
Beans.get(SaleOrderServiceSupplychainImpl.class).updateAmountToBeSpreadOverTheTimetable(saleOrder);
response.setValue("amountToBeSpreadOverTheTimetable", saleOrder.getAmountToBeSpreadOverTheTimetable());
}
use of com.axelor.apps.sale.db.SaleOrder in project axelor-open-suite by axelor.
the class SaleOrderController method supplierPartnerSelectDomain.
/**
* Called from sale order generate purchase order form. Set domain for supplier partner.
*
* @param request
* @param response
*/
public void supplierPartnerSelectDomain(ActionRequest request, ActionResponse response) {
SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
String domain = "self.isContact = false AND self.isSupplier = true";
String blockedPartnerQuery = Beans.get(BlockingService.class).listOfBlockedPartner(saleOrder.getCompany(), BlockingRepository.PURCHASE_BLOCKING);
if (!Strings.isNullOrEmpty(blockedPartnerQuery)) {
domain += String.format(" AND self.id NOT in (%s)", blockedPartnerQuery);
}
if (saleOrder.getCompany() != null) {
domain += " AND " + saleOrder.getCompany().getId() + " in (SELECT id FROM self.companySet)";
}
response.setAttr("supplierPartnerSelect", "domain", domain);
}
Aggregations