Search in sources :

Example 11 with AnalyticMoveLine

use of com.axelor.apps.account.db.AnalyticMoveLine in project axelor-open-suite by axelor.

the class InvoiceLineProjectController method setProjectToAnalyticDistribution.

public void setProjectToAnalyticDistribution(ActionRequest request, ActionResponse response) {
    try {
        InvoiceLine invoiceLine = request.getContext().asType(InvoiceLine.class);
        List<AnalyticMoveLine> analyticMoveLines = invoiceLine.getAnalyticMoveLineList();
        if (analyticMoveLines != null) {
            response.setValue("analyticMoveLineList", Beans.get(InvoiceLineProjectService.class).setProjectToAnalyticDistribution(invoiceLine, analyticMoveLines));
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : InvoiceLine(com.axelor.apps.account.db.InvoiceLine) AnalyticMoveLine(com.axelor.apps.account.db.AnalyticMoveLine)

Example 12 with AnalyticMoveLine

use of com.axelor.apps.account.db.AnalyticMoveLine in project axelor-open-suite by axelor.

the class AnalyticMoveLineSupplychainRepository method copy.

@Override
public AnalyticMoveLine copy(AnalyticMoveLine entity, boolean deep) {
    AnalyticMoveLine copy = super.copy(entity, deep);
    copy.setPurchaseOrderLine(null);
    copy.setSaleOrderLine(null);
    return copy;
}
Also used : AnalyticMoveLine(com.axelor.apps.account.db.AnalyticMoveLine)

Example 13 with AnalyticMoveLine

use of com.axelor.apps.account.db.AnalyticMoveLine in project axelor-open-suite by axelor.

the class PurchaseOrderLineServiceProjectImpl method createAnalyticDistributionWithTemplate.

@Override
public PurchaseOrderLine createAnalyticDistributionWithTemplate(PurchaseOrderLine purchaseOrderLine) {
    PurchaseOrderLine poLine = super.createAnalyticDistributionWithTemplate(purchaseOrderLine);
    List<AnalyticMoveLine> analyticMoveLineList = poLine.getAnalyticMoveLineList();
    if (poLine.getProject() != null && analyticMoveLineList != null) {
        analyticMoveLineList.forEach(analyticLine -> analyticLine.setProject(poLine.getProject()));
    }
    return poLine;
}
Also used : PurchaseOrderLine(com.axelor.apps.purchase.db.PurchaseOrderLine) AnalyticMoveLine(com.axelor.apps.account.db.AnalyticMoveLine)

Example 14 with AnalyticMoveLine

use of com.axelor.apps.account.db.AnalyticMoveLine in project axelor-open-suite by axelor.

the class PurchaseOrderWorkflowServiceProjectImpl method cancelPurchaseOrder.

@Override
@Transactional
public void cancelPurchaseOrder(PurchaseOrder purchaseOrder) {
    super.cancelPurchaseOrder(purchaseOrder);
    for (PurchaseOrderLine purchaseOrderLine : purchaseOrder.getPurchaseOrderLineList()) {
        for (AnalyticMoveLine analyticMoveLine : purchaseOrderLine.getAnalyticMoveLineList()) {
            analyticMoveLine.setProject(null);
            analyticMoveLineRepository.save(analyticMoveLine);
        }
    }
}
Also used : PurchaseOrderLine(com.axelor.apps.purchase.db.PurchaseOrderLine) AnalyticMoveLine(com.axelor.apps.account.db.AnalyticMoveLine) Transactional(com.google.inject.persist.Transactional)

Example 15 with AnalyticMoveLine

use of com.axelor.apps.account.db.AnalyticMoveLine in project axelor-open-suite by axelor.

the class ProjectAnalyticMoveLineServiceImpl method updateLines.

@Override
@Transactional(rollbackOn = Exception.class)
public SaleOrder updateLines(SaleOrder saleOrder) {
    for (SaleOrderLine orderLine : saleOrder.getSaleOrderLineList()) {
        orderLine.setProject(saleOrder.getProject());
        for (AnalyticMoveLine analyticMoveLine : orderLine.getAnalyticMoveLineList()) {
            analyticMoveLine.setProject(saleOrder.getProject());
            analyticMoveLineRepository.save(analyticMoveLine);
        }
    }
    return saleOrder;
}
Also used : SaleOrderLine(com.axelor.apps.sale.db.SaleOrderLine) AnalyticMoveLine(com.axelor.apps.account.db.AnalyticMoveLine) Transactional(com.google.inject.persist.Transactional)

Aggregations

AnalyticMoveLine (com.axelor.apps.account.db.AnalyticMoveLine)30 MoveLine (com.axelor.apps.account.db.MoveLine)7 Transactional (com.google.inject.persist.Transactional)6 BigDecimal (java.math.BigDecimal)6 AnalyticMoveLineRepository (com.axelor.apps.account.db.repo.AnalyticMoveLineRepository)5 ArrayList (java.util.ArrayList)5 Account (com.axelor.apps.account.db.Account)4 InvoiceLine (com.axelor.apps.account.db.InvoiceLine)4 SaleOrderLine (com.axelor.apps.sale.db.SaleOrderLine)4 AxelorException (com.axelor.exception.AxelorException)4 TaxPaymentMoveLine (com.axelor.apps.account.db.TaxPaymentMoveLine)3 Company (com.axelor.apps.base.db.Company)3 PurchaseOrderLine (com.axelor.apps.purchase.db.PurchaseOrderLine)3 LocalDate (java.time.LocalDate)3 AnalyticAccount (com.axelor.apps.account.db.AnalyticAccount)2 Move (com.axelor.apps.account.db.Move)2 TaxLine (com.axelor.apps.account.db.TaxLine)2 AnalyticMoveLineService (com.axelor.apps.account.service.AnalyticMoveLineService)2 InvoiceLineService (com.axelor.apps.account.service.invoice.InvoiceLineService)2 Partner (com.axelor.apps.base.db.Partner)2