Search in sources :

Example 16 with FixedAsset

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

the class TestFixedAssetService method generateAndComputeLineProrataLinearFixedAssetNoProrataNeeded.

/*
   * ================================================================================================
   * ==  Linear fixed asset with prorata but acquisition date is equal to first depreciation date  ==
   * ================================================================================================
   */
protected FixedAsset generateAndComputeLineProrataLinearFixedAssetNoProrataNeeded() {
    FixedAsset fixedAsset = createFixedAsset(FixedAssetRepository.COMPUTATION_METHOD_LINEAR, LocalDate.of(2020, 12, 31), LocalDate.of(2020, 12, 31), 5, 12, createFixedAssetCategoryFromIsProrataTemporis(true), new BigDecimal("500.00"));
    fixedAssetService.generateAndComputeLines(fixedAsset);
    return fixedAsset;
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal)

Example 17 with FixedAsset

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

the class TestFixedAssetService method testGenerateAndComputeLinesProrataDegressiveFixedAssetThirdLine.

@Test
public void testGenerateAndComputeLinesProrataDegressiveFixedAssetThirdLine() {
    FixedAsset fixedAsset = generateAndComputeLinesProrataDegressiveFixedAsset();
    assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2023, 12, 31), new BigDecimal("18788.82"), new BigDecimal("62973.06"), new BigDecimal("39665.29")), fixedAsset.getFixedAssetLineList().get(2));
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 18 with FixedAsset

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

the class TestFixedAssetService method generateAndComputeLineUsProrataLinearFixedAsset.

/*
   * =====================================
   * ==  US prorata linear fixed asset  ==
   * =====================================
   */
protected FixedAsset generateAndComputeLineUsProrataLinearFixedAsset() {
    FixedAsset fixedAsset = createFixedAsset(FixedAssetRepository.COMPUTATION_METHOD_LINEAR, LocalDate.of(2020, 7, 1), LocalDate.of(2020, 12, 31), 7, 12, createFixedAssetCategoryFromIsProrataTemporis(true, true), new BigDecimal("102638.35"));
    fixedAssetService.generateAndComputeLines(fixedAsset);
    return fixedAsset;
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal)

Example 19 with FixedAsset

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

the class TestFixedAssetService method generateAndComputeLineSimpleLinearFixedAsset.

/*
   * =================================
   * ==  Simple linear fixed asset  ==
   * =================================
   */
protected FixedAsset generateAndComputeLineSimpleLinearFixedAsset() {
    FixedAsset fixedAsset = createFixedAsset(FixedAssetRepository.COMPUTATION_METHOD_LINEAR, LocalDate.of(2020, 10, 4), LocalDate.of(2020, 12, 31), 5, 12, createFixedAssetCategoryFromIsProrataTemporis(false), new BigDecimal("500.00"));
    fixedAssetService.generateAndComputeLines(fixedAsset);
    return fixedAsset;
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal)

Example 20 with FixedAsset

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

the class TestFixedAssetService method testGenerateAndComputeLinesProrataLinearFixedAssetFourthLine.

@Test
public void testGenerateAndComputeLinesProrataLinearFixedAssetFourthLine() {
    FixedAsset fixedAsset = generateAndComputeLineProrataLinearFixedAsset();
    assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2023, 12, 31), new BigDecimal("100.00"), new BigDecimal("323.89"), new BigDecimal("176.11")), fixedAsset.getFixedAssetLineList().get(3));
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

FixedAsset (com.axelor.apps.account.db.FixedAsset)65 FixedAssetTestTool.createFixedAsset (com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset)52 BigDecimal (java.math.BigDecimal)52 Test (org.junit.Test)47 FixedAssetLine (com.axelor.apps.account.db.FixedAssetLine)12 FixedAssetTestTool.createFixedAssetLine (com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAssetLine)10 Transactional (com.google.inject.persist.Transactional)6 AxelorException (com.axelor.exception.AxelorException)5 ArrayList (java.util.ArrayList)5 LocalDate (java.time.LocalDate)4 MoveLine (com.axelor.apps.account.db.MoveLine)3 FixedAssetRepository (com.axelor.apps.account.db.repo.FixedAssetRepository)3 FixedAssetService (com.axelor.apps.account.service.fixedasset.FixedAssetService)3 Account (com.axelor.apps.account.db.Account)2 AccountConfig (com.axelor.apps.account.db.AccountConfig)2 InvoiceLine (com.axelor.apps.account.db.InvoiceLine)2 Journal (com.axelor.apps.account.db.Journal)2 Move (com.axelor.apps.account.db.Move)2 Company (com.axelor.apps.base.db.Company)2 Partner (com.axelor.apps.base.db.Partner)2