IDEMPIERE-3947:when complete asset addtion, asset need update before run asset depreciation

Fixed Asset bugs and enhancements
add interface to easy implement FA depreciation method

step:
1. create MR with default date is today
2. create invoice with default date is today
3. when complete invoice it generate asset addition.
3. on asset addition change document date to 5/2/2019
4. so it will copy to "service date" of asset when complete
5. but depreciation run before step 4. so in case depreciation depend on "service date" it will wrong
This commit is contained in:
hieplq 2019-08-16 13:49:08 +07:00
parent 8790af0262
commit 9a6ab2b562
1 changed files with 18 additions and 18 deletions

View File

@ -642,6 +642,24 @@ public class MAssetAddition extends X_A_Asset_Addition
//loading asset
MAsset asset = getA_Asset(!m_justPrepared); // requery if not just prepared
if (log.isLoggable(Level.FINE)) log.fine("asset=" + asset);
// Setting locator if is CreateAsset
if (isA_CreateAsset() && getM_Locator_ID() > 0)
{
asset.setM_Locator_ID(getM_Locator_ID());
}
// Creating/Updating asset product
updateA_Asset_Product(false);
//
// Changing asset status to Activated or Depreciated
if (isA_CreateAsset())
{
asset.setAssetServiceDate(getDateDoc());
}
asset.changeStatus(MAsset.A_ASSET_STATUS_Activated, getDateAcct());
asset.saveEx();
//
// Get/Create Asset Workfile:
@ -714,24 +732,6 @@ public class MAssetAddition extends X_A_Asset_Addition
MAssetChange.createAddition(this, assetwk);
// Setting locator if is CreateAsset
if (isA_CreateAsset() && getM_Locator_ID() > 0)
{
asset.setM_Locator_ID(getM_Locator_ID());
}
// Creating/Updating asset product
updateA_Asset_Product(false);
//
// Changing asset status to Activated or Depreciated
if (isA_CreateAsset())
{
asset.setAssetServiceDate(getDateDoc());
}
asset.changeStatus(MAsset.A_ASSET_STATUS_Activated, getDateAcct());
asset.saveEx();
// Accumulated depreciation (if any):
/*