Search in sources :

Example 71 with Partner

use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.

the class PartnerController method showPartnerOnMap.

public void showPartnerOnMap(ActionRequest request, ActionResponse response) {
    try {
        Partner partner = request.getContext().asType(Partner.class);
        response.setView(ActionView.define(partner.getFullName()).add("html", Beans.get(AppBaseService.class).getAppBase().getMapApiSelect() == AppBaseRepository.MAP_API_GOOGLE ? Beans.get(MapService.class).getMapURI("partner", partner.getId()) : Beans.get(MapService.class).getOsmMapURI("partner", partner.getId())).map());
    } catch (Exception e) {
        TraceBackService.trace(e);
    }
}
Also used : AppBaseService(com.axelor.apps.base.service.app.AppBaseService) MapService(com.axelor.apps.base.service.MapService) Partner(com.axelor.apps.base.db.Partner) BirtException(org.eclipse.birt.core.exception.BirtException) IbanFormatException(org.iban4j.IbanFormatException) InvalidCheckDigitException(org.iban4j.InvalidCheckDigitException) AxelorException(com.axelor.exception.AxelorException) UnsupportedCountryException(org.iban4j.UnsupportedCountryException) IOException(java.io.IOException)

Example 72 with Partner

use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.

the class PartnerController method modifyRegistrationCode.

public void modifyRegistrationCode(ActionRequest request, ActionResponse response) {
    try {
        Partner partner = request.getContext().asType(Partner.class);
        String taxNbr = Beans.get(PartnerService.class).getTaxNbrFromRegistrationCode(partner);
        String nic = Beans.get(PartnerService.class).getNicFromRegistrationCode(partner);
        String siren = Beans.get(PartnerService.class).getSirenFromRegistrationCode(partner);
        response.setValue("taxNbr", taxNbr);
        response.setValue("nic", nic);
        response.setValue("siren", siren);
    } catch (Exception e) {
        TraceBackService.trace(e);
    }
}
Also used : PartnerService(com.axelor.apps.base.service.PartnerService) Partner(com.axelor.apps.base.db.Partner) BirtException(org.eclipse.birt.core.exception.BirtException) IbanFormatException(org.iban4j.IbanFormatException) InvalidCheckDigitException(org.iban4j.InvalidCheckDigitException) AxelorException(com.axelor.exception.AxelorException) UnsupportedCountryException(org.iban4j.UnsupportedCountryException) IOException(java.io.IOException)

Example 73 with Partner

use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.

the class PartnerController method checkPartnerName.

/**
 * Called from partner view on name change and onLoad. Call {@link
 * PartnerService#isThereDuplicatePartner(Partner)}
 *
 * @param request
 * @param response
 */
public void checkPartnerName(ActionRequest request, ActionResponse response) {
    try {
        Partner partner = request.getContext().asType(Partner.class);
        response.setAttr("duplicatePartnerText", "hidden", !Beans.get(PartnerService.class).isThereDuplicatePartner(partner));
    } catch (Exception e) {
        TraceBackService.trace(e);
    }
}
Also used : PartnerService(com.axelor.apps.base.service.PartnerService) Partner(com.axelor.apps.base.db.Partner) BirtException(org.eclipse.birt.core.exception.BirtException) IbanFormatException(org.iban4j.IbanFormatException) InvalidCheckDigitException(org.iban4j.InvalidCheckDigitException) AxelorException(com.axelor.exception.AxelorException) UnsupportedCountryException(org.iban4j.UnsupportedCountryException) IOException(java.io.IOException)

Example 74 with Partner

use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.

the class PartnerController method setPartnerSequence.

public void setPartnerSequence(ActionRequest request, ActionResponse response) throws AxelorException {
    Partner partner = request.getContext().asType(Partner.class);
    partner = Beans.get(PartnerRepository.class).find(partner.getId());
    if (partner.getPartnerSeq() == null) {
        String seq = Beans.get(SequenceService.class).getSequenceNumber(SequenceRepository.PARTNER);
        if (seq == null)
            throw new AxelorException(partner, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.PARTNER_1));
        else
            response.setValue("partnerSeq", seq);
    }
}
Also used : AxelorException(com.axelor.exception.AxelorException) SequenceService(com.axelor.apps.base.service.administration.SequenceService) Partner(com.axelor.apps.base.db.Partner)

Example 75 with Partner

use of com.axelor.apps.base.db.Partner in project axelor-open-suite by axelor.

the class PartnerController method printClientSituation.

/* Fonction appeler par le bouton imprimer
   *
   * @param request
   * @param response
   * @return
   */
public void printClientSituation(ActionRequest request, ActionResponse response) throws AxelorException {
    Partner partner = request.getContext().asType(Partner.class);
    User user = AuthUtils.getUser();
    String name = I18n.get("Customer Situation");
    String fileLink = ReportFactory.createReport(IReport.CLIENT_SITUATION, name + "-${date}").addParam("Locale", ReportSettings.getPrintingLocale(partner)).addParam("Timezone", getTimezone(user)).addParam("UserId", user.getId()).addParam("PartnerId", partner.getId()).addParam("PartnerPic", partner.getPicture() != null ? MetaFiles.getPath(partner.getPicture()).toString() : "").generate().getFileLink();
    LOG.debug("Printing " + name);
    response.setView(ActionView.define(name).add("html", fileLink).map());
}
Also used : User(com.axelor.auth.db.User) Partner(com.axelor.apps.base.db.Partner)

Aggregations

Partner (com.axelor.apps.base.db.Partner)199 AxelorException (com.axelor.exception.AxelorException)68 Company (com.axelor.apps.base.db.Company)67 Transactional (com.google.inject.persist.Transactional)54 BigDecimal (java.math.BigDecimal)43 ArrayList (java.util.ArrayList)34 MoveLine (com.axelor.apps.account.db.MoveLine)32 Move (com.axelor.apps.account.db.Move)30 PaymentMode (com.axelor.apps.account.db.PaymentMode)26 LocalDate (java.time.LocalDate)26 Account (com.axelor.apps.account.db.Account)25 Invoice (com.axelor.apps.account.db.Invoice)24 BankDetails (com.axelor.apps.base.db.BankDetails)24 List (java.util.List)22 PartnerService (com.axelor.apps.base.service.PartnerService)18 Map (java.util.Map)18 Journal (com.axelor.apps.account.db.Journal)17 Address (com.axelor.apps.base.db.Address)14 Currency (com.axelor.apps.base.db.Currency)14 AccountConfig (com.axelor.apps.account.db.AccountConfig)13