use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class InvoiceController method fillAdvancePaymentInvoiceSet.
/**
* Called on partner and currency change, fill the domain of the field {@link
* Invoice#advancePaymentInvoiceSet} with default values. The default values are every invoices
* found in the domain.
*
* @param request
* @param response
*/
public void fillAdvancePaymentInvoiceSet(ActionRequest request, ActionResponse response) {
Invoice invoice = request.getContext().asType(Invoice.class);
try {
Set<Invoice> invoices = Beans.get(InvoiceService.class).getDefaultAdvancePaymentInvoice(invoice);
response.setValue("advancePaymentInvoiceSet", invoices);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class InvoiceController method fillAdvancePaymentInvoiceSetDomain.
/**
* Called on load and on new, create the domain for the field {@link
* Invoice#advancePaymentInvoiceSet}
*
* @param request
* @param response
*/
public void fillAdvancePaymentInvoiceSetDomain(ActionRequest request, ActionResponse response) {
Invoice invoice = request.getContext().asType(Invoice.class);
try {
String domain = Beans.get(InvoiceService.class).createAdvancePaymentInvoiceSetDomain(invoice);
response.setAttr("advancePaymentInvoiceSet", "domain", domain);
} catch (Exception e) {
TraceBackService.trace(e);
response.setError(e.getMessage());
}
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class InvoiceController method checkNotImputedRefunds.
public void checkNotImputedRefunds(ActionRequest request, ActionResponse response) {
Invoice invoice = request.getContext().asType(Invoice.class);
invoice = Beans.get(InvoiceRepository.class).find(invoice.getId());
try {
String msg = Beans.get(InvoiceService.class).checkNotImputedRefunds(invoice);
if (msg != null) {
response.setFlash(msg);
}
} catch (AxelorException e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class InvoiceController method cancel.
/**
* Passe l'état de la facture à "annulée"
*
* @param request
* @param response
* @throws AxelorException
*/
public void cancel(ActionRequest request, ActionResponse response) throws AxelorException {
Invoice invoice = request.getContext().asType(Invoice.class);
invoice = Beans.get(InvoiceRepository.class).find(invoice.getId());
if (invoice.getStatusSelect() == InvoiceRepository.STATUS_VENTILATED && invoice.getCompany().getAccountConfig() != null && !invoice.getCompany().getAccountConfig().getAllowCancelVentilatedInvoice()) {
response.setError(I18n.get(IExceptionMessage.INVOICE_CAN_NOT_GO_BACK_TO_VALIDATE_STATUS_OR_CANCEL_VENTILATED_INVOICE));
return;
}
Beans.get(InvoiceService.class).cancel(invoice);
response.setFlash(I18n.get(IExceptionMessage.INVOICE_1));
response.setReload(true);
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class InvoiceController method setPfpValidatorUser.
public void setPfpValidatorUser(ActionRequest request, ActionResponse response) {
Invoice invoice = request.getContext().asType(Invoice.class);
response.setValue("pfpValidatorUser", Beans.get(InvoiceService.class).getPfpValidatorUser(invoice));
}
Aggregations