use of com.axelor.apps.account.db.AnalyticDistributionTemplate in project axelor-open-suite by axelor.
the class InvoiceLineServiceImpl method getAndComputeAnalyticDistribution.
public List<AnalyticMoveLine> getAndComputeAnalyticDistribution(InvoiceLine invoiceLine, Invoice invoice) {
if (appAccountService.getAppAccount().getAnalyticDistributionTypeSelect() == AppAccountRepository.DISTRIBUTION_TYPE_FREE) {
return MoreObjects.firstNonNull(invoiceLine.getAnalyticMoveLineList(), new ArrayList<>());
}
AnalyticDistributionTemplate analyticDistributionTemplate = analyticMoveLineService.getAnalyticDistributionTemplate(invoice.getPartner(), invoiceLine.getProduct(), invoice.getCompany());
invoiceLine.setAnalyticDistributionTemplate(analyticDistributionTemplate);
if (invoiceLine.getAnalyticMoveLineList() != null) {
invoiceLine.getAnalyticMoveLineList().clear();
}
return this.computeAnalyticDistribution(invoiceLine);
}
use of com.axelor.apps.account.db.AnalyticDistributionTemplate in project axelor-open-suite by axelor.
the class PurchaseOrderLineServiceSupplychainImpl method getAndComputeAnalyticDistribution.
public PurchaseOrderLine getAndComputeAnalyticDistribution(PurchaseOrderLine purchaseOrderLine, PurchaseOrder purchaseOrder) {
if (appAccountService.getAppAccount().getAnalyticDistributionTypeSelect() == AppAccountRepository.DISTRIBUTION_TYPE_FREE) {
return purchaseOrderLine;
}
AnalyticDistributionTemplate analyticDistributionTemplate = analyticMoveLineService.getAnalyticDistributionTemplate(purchaseOrder.getSupplierPartner(), purchaseOrderLine.getProduct(), purchaseOrder.getCompany());
purchaseOrderLine.setAnalyticDistributionTemplate(analyticDistributionTemplate);
if (purchaseOrderLine.getAnalyticMoveLineList() != null) {
purchaseOrderLine.getAnalyticMoveLineList().clear();
}
this.computeAnalyticDistribution(purchaseOrderLine);
return purchaseOrderLine;
}
use of com.axelor.apps.account.db.AnalyticDistributionTemplate in project axelor-open-suite by axelor.
the class ExpenseServiceImpl method getAndComputeAnalyticDistribution.
@Override
public ExpenseLine getAndComputeAnalyticDistribution(ExpenseLine expenseLine, Expense expense) {
if (appAccountService.getAppAccount().getAnalyticDistributionTypeSelect() == AppAccountRepository.DISTRIBUTION_TYPE_FREE) {
return expenseLine;
}
AnalyticDistributionTemplate analyticDistributionTemplate = analyticMoveLineService.getAnalyticDistributionTemplate(expenseLine.getUser().getPartner(), expenseLine.getExpenseProduct(), expense.getCompany());
expenseLine.setAnalyticDistributionTemplate(analyticDistributionTemplate);
if (expenseLine.getAnalyticMoveLineList() != null) {
expenseLine.getAnalyticMoveLineList().clear();
}
this.computeAnalyticDistribution(expenseLine);
return expenseLine;
}
use of com.axelor.apps.account.db.AnalyticDistributionTemplate in project axelor-open-suite by axelor.
the class AccountingCutOffServiceImpl method getAndComputeAnalyticDistribution.
protected void getAndComputeAnalyticDistribution(Product product, Move move, MoveLine moveLine) {
if (appAccountService.getAppAccount().getAnalyticDistributionTypeSelect() == AppAccountRepository.DISTRIBUTION_TYPE_FREE) {
return;
}
AnalyticDistributionTemplate analyticDistributionTemplate = analyticMoveLineService.getAnalyticDistributionTemplate(move.getPartner(), product, move.getCompany());
moveLine.setAnalyticDistributionTemplate(analyticDistributionTemplate);
List<AnalyticMoveLine> analyticMoveLineList = moveLineService.createAnalyticDistributionWithTemplate(moveLine).getAnalyticMoveLineList();
for (AnalyticMoveLine analyticMoveLine : analyticMoveLineList) {
analyticMoveLine.setMoveLine(moveLine);
}
analyticMoveLineList.stream().forEach(analyticMoveLineRepository::save);
}
use of com.axelor.apps.account.db.AnalyticDistributionTemplate in project axelor-open-suite by axelor.
the class SaleOrderLineServiceSupplyChainImpl method getAndComputeAnalyticDistribution.
public SaleOrderLine getAndComputeAnalyticDistribution(SaleOrderLine saleOrderLine, SaleOrder saleOrder) {
if (appAccountService.getAppAccount().getAnalyticDistributionTypeSelect() == AppAccountRepository.DISTRIBUTION_TYPE_FREE) {
return saleOrderLine;
}
AnalyticDistributionTemplate analyticDistributionTemplate = analyticMoveLineService.getAnalyticDistributionTemplate(saleOrder.getClientPartner(), saleOrderLine.getProduct(), saleOrder.getCompany());
saleOrderLine.setAnalyticDistributionTemplate(analyticDistributionTemplate);
if (saleOrderLine.getAnalyticMoveLineList() != null) {
saleOrderLine.getAnalyticMoveLineList().clear();
}
this.computeAnalyticDistribution(saleOrderLine);
return saleOrderLine;
}
Aggregations