use of com.axelor.apps.account.db.PaymentMode in project axelor-open-suite by axelor.
the class InvoiceController method fillCompanyBankDetails.
/**
* Called on load and in partner, company or payment mode change. Fill the bank details with a
* default value.
*
* @param request
* @param response
* @throws AxelorException
*/
public void fillCompanyBankDetails(ActionRequest request, ActionResponse response) throws AxelorException {
Invoice invoice = request.getContext().asType(Invoice.class);
PaymentMode paymentMode = invoice.getPaymentMode();
Company company = invoice.getCompany();
Partner partner = invoice.getPartner();
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, invoice.getOperationTypeSelect());
response.setValue("companyBankDetails", defaultBankDetails);
}
use of com.axelor.apps.account.db.PaymentMode in project axelor-open-suite by axelor.
the class InvoicePaymentController method filterPaymentMode.
// filter the payment mode depending on the target invoice
@SuppressWarnings("unchecked")
public void filterPaymentMode(ActionRequest request, ActionResponse response) {
Map<String, Object> partialInvoice = (Map<String, Object>) request.getContext().get("_invoice");
Invoice invoice = Beans.get(InvoiceRepository.class).find(Long.valueOf(partialInvoice.get("id").toString()));
PaymentMode paymentMode = invoice.getPaymentMode();
if (invoice != null && paymentMode != null) {
if (paymentMode.getInOutSelect() != null) {
response.setAttr("paymentMode", "domain", "self.inOutSelect = " + paymentMode.getInOutSelect());
}
}
}
use of com.axelor.apps.account.db.PaymentMode in project axelor-open-suite by axelor.
the class PaymentVoucherController method fillCompanyBankDetails.
/**
* Called on load and in partner, company or payment mode change. Fill the bank details with a
* default value.
*
* @param request
* @param response
* @throws AxelorException
*/
public void fillCompanyBankDetails(ActionRequest request, ActionResponse response) throws AxelorException {
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
Company company = paymentVoucher.getCompany();
Partner partner = paymentVoucher.getPartner();
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);
}
use of com.axelor.apps.account.db.PaymentMode in project axelor-open-suite by axelor.
the class PaymentVoucherController method askPaymentVoucher.
public void askPaymentVoucher(ActionRequest request, ActionResponse response) {
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
if (paymentVoucher.getHasAutoInput()) {
PaymentMode paymentMode = paymentVoucher.getPaymentMode();
Company company = paymentVoucher.getCompany();
BankDetails companyBankDetails = paymentVoucher.getCompanyBankDetails();
try {
Journal journal = Beans.get(PaymentModeService.class).getPaymentModeJournal(paymentMode, company, companyBankDetails);
if (journal.getExcessPaymentOk()) {
response.setAlert(I18n.get("No items have been selected. Do you want to continue?"));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
}
use of com.axelor.apps.account.db.PaymentMode in project axelor-open-suite by axelor.
the class CompanyBankDetailsController method fillCompanyBankDetailsDomain.
/**
* Set the domain of company bank details field
*
* @param request
* @param response
* @throws AxelorException
*/
public void fillCompanyBankDetailsDomain(ActionRequest request, ActionResponse response) throws AxelorException {
Partner partner = (Partner) request.getContext().get("partner");
Company company = (Company) request.getContext().get("company");
PaymentMode paymentMode = (PaymentMode) request.getContext().get("paymentMode");
Integer operationTypeSelect = null;
if (request.getContext().get("_operationTypeSelect") != null) {
operationTypeSelect = Integer.valueOf(request.getContext().get("_operationTypeSelect").toString());
}
response.setAttr("companyBankDetails", "domain", Beans.get(BankDetailsServiceImpl.class).createCompanyBankDetailsDomain(partner, company, paymentMode, operationTypeSelect));
}
Aggregations