use of com.axelor.apps.purchase.db.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderController method fillCompanyBankDetails.
/**
* Called on partner, company or payment change. Fill the bank details with a default value.
*
* @param request
* @param response
*/
public void fillCompanyBankDetails(ActionRequest request, ActionResponse response) {
try {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
PaymentMode paymentMode = (PaymentMode) request.getContext().get("paymentMode");
Company company = purchaseOrder.getCompany();
Partner partner = purchaseOrder.getSupplierPartner();
if (company == null) {
return;
}
if (partner != null) {
partner = Beans.get(PartnerRepository.class).find(partner.getId());
}
BankDetails defaultBankDetails = Beans.get(BankDetailsService.class).getDefaultCompanyBankDetails(company, paymentMode, partner, null);
response.setValue("companyBankDetails", defaultBankDetails);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderController method fillPriceList.
/**
* Called from purchase order form view on partner change. Get the default price list for the
* purchase order. Call {@link PartnerPriceListService#getDefaultPriceList(Partner, int)}.
*
* @param request
* @param response
*/
public void fillPriceList(ActionRequest request, ActionResponse response) {
try {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
response.setValue("priceList", Beans.get(PartnerPriceListService.class).getDefaultPriceList(purchaseOrder.getSupplierPartner(), PriceListRepository.TYPE_PURCHASE));
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderController method requestPurchaseOrder.
public void requestPurchaseOrder(ActionRequest request, ActionResponse response) {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
try {
Beans.get(PurchaseOrderService.class).requestPurchaseOrder(Beans.get(PurchaseOrderRepository.class).find(purchaseOrder.getId()));
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderController method finishPurchaseOrder.
public void finishPurchaseOrder(ActionRequest request, ActionResponse response) {
try {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
purchaseOrder = Beans.get(PurchaseOrderRepository.class).find(purchaseOrder.getId());
Beans.get(PurchaseOrderWorkflowService.class).finishPurchaseOrder(purchaseOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.purchase.db.PurchaseOrder in project axelor-open-suite by axelor.
the class PurchaseOrderController method changePriceListDomain.
public void changePriceListDomain(ActionRequest request, ActionResponse response) {
try {
PurchaseOrder purchaseOrder = request.getContext().asType(PurchaseOrder.class);
String domain = Beans.get(PartnerPriceListService.class).getPriceListDomain(purchaseOrder.getSupplierPartner(), PriceListRepository.TYPE_PURCHASE);
response.setAttr("priceList", "domain", domain);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations