use of com.axelor.apps.account.db.AccountManagement in project axelor-open-suite by axelor.
the class AccountManagementServiceAccountImpl method getProductFixedAssetCategory.
/**
* Get the product fixed asset category
*
* @param product
* @param company
* @param configObject Specify if we want get the fixed asset category from the product or its
* product family
* <li>1 : product
* <li>2 : product family
* @return
* @throws AxelorException
*/
protected FixedAssetCategory getProductFixedAssetCategory(Product product, Company company, int configObject) {
AccountManagement accountManagement = this.getAccountManagement(product, company, configObject);
FixedAssetCategory fixedAssetCategory = null;
if (accountManagement != null) {
fixedAssetCategory = accountManagement.getFixedAssetCategory();
}
if (fixedAssetCategory == null && configObject == CONFIG_OBJECT_PRODUCT) {
return getProductFixedAssetCategory(product, company, CONFIG_OBJECT_PRODUCT_FAMILY);
}
return fixedAssetCategory;
}
use of com.axelor.apps.account.db.AccountManagement in project axelor-open-suite by axelor.
the class BankDetailsServiceAccountImpl method createCompanyBankDetailsDomain.
/**
* In this implementation, we use the O2M in payment mode.
*
* @param company
* @param paymentMode
* @return
* @throws AxelorException
*/
@Override
public String createCompanyBankDetailsDomain(Partner partner, Company company, PaymentMode paymentMode, Integer operationTypeSelect) throws AxelorException {
AppAccountService appAccountService = Beans.get(AppAccountService.class);
if (!appAccountService.isApp("account") || !appAccountService.getAppBase().getManageMultiBanks()) {
return super.createCompanyBankDetailsDomain(partner, company, paymentMode, operationTypeSelect);
} else {
if (partner != null) {
partner = Beans.get(PartnerRepository.class).find(partner.getId());
}
List<BankDetails> authorizedBankDetails = new ArrayList<>();
if (partner != null && partner.getFactorizedCustomer() && operationTypeSelect != null && (operationTypeSelect.intValue() == InvoiceRepository.OPERATION_TYPE_CLIENT_SALE || operationTypeSelect.intValue() == InvoiceRepository.OPERATION_TYPE_CLIENT_REFUND)) {
authorizedBankDetails = createCompanyBankDetailsDomainFromFactorPartner(company);
} else {
if (paymentMode == null) {
return "self.id IN (0)";
}
List<AccountManagement> accountManagementList = paymentMode.getAccountManagementList();
authorizedBankDetails = new ArrayList<>();
for (AccountManagement accountManagement : accountManagementList) {
if (accountManagement.getCompany() != null && accountManagement.getCompany().equals(company)) {
authorizedBankDetails.add(accountManagement.getBankDetails());
}
}
}
if (authorizedBankDetails.isEmpty()) {
return "self.id IN (0)";
} else {
return "self.id IN (" + StringTool.getIdListString(authorizedBankDetails) + ") AND self.active = true";
}
}
}
Aggregations