Skip to main content
Solved

How to overwrite Transaction Description field when generate FATran in Calculate Deprecation Process?

  • February 27, 2023
  • 7 replies
  • 90 views

Forum|alt.badge.img

Hi there,

I am trying to overwrite field Transaction Description with value is taken from Description of Fixed Assets

and I found that these FATran in red rectangle are generated from action CalcDeprProcess on screen Calculate Depreciation (FA502000) and handled in function SetProcessDelegate()

 

I don’t know if there is any way to over-write function AssetProcess.DepreciateAsset? I can’t find source code of this function.

Could you please share your idea?

 

Thank you in advanced.

Best answer by aaghaei

I had a look at the Method Override. I believe you need to override

public static bool DepreciateAsset(IEnumerable<FABookBalance> books, DateTime? DateTo, string PeriodTo, bool IsMassProcess, bool IncludeLastPeriod)

in AssetProcess graph if you wish but you need to consider it is the worst type of override you have to do (the change should be made in the middle of the method meaning you have to copy/paste the method code and make the change which is not really an override (typically we make changes at the beginning or end and call the base method accordingly).

My suggestion: Do not do it because 1) you do not need to do it really 2) in each update you have to compare and revise your code according to Acumatica changes that mean high maintenance 3) will take more time and is more complex to develop

Instead, override FATran RowInserting/Inserted Handler for the Depreciation Type transaction as you want which it really where it should do, doesn’t need any maintenance unless Acumatica makes a fundamental change to its platform and can be developed and tested within one hour.

 

But as mentioned it is your choice.

View original
Did this topic help you find an answer to your question?

7 replies

Forum|alt.badge.img+6
  • Captain II
  • 562 replies
  • February 27, 2023

I searched through the source code and found that method in AssetProcess.cs. 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • 1204 replies
  • February 27, 2023

@mrthanhkhoi I am not sure what you really trying to achieve but possibly your best option is to Override RowInserting/RowInserted event of the FATran based on the TranType you would like to override. In this table, you have all the references to the Asset/ParentAsset and can get the pieces of data from there or other linked entities or add fixed values as you wish.


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 85 replies
  • February 28, 2023

@Django  thank you for your answer. I could find the file AssetProcess.cs at following directory:

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 85 replies
  • February 28, 2023

Hello @aaghaei,

Thank you for your response. My wish is overriding value of field Transaction Description which is generated by CalcDeprProcess because it always has formula like: “Depreciation for Asset <FA Number>”

 and field Transaction Description shouldn’t be override If it is created manually such as: created by screen Fixed Asset Transactions 

 

 

so I think we should set value in action CalcDeprProcess

Looking forward to see your idea.

 

Thanks


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • 1204 replies
  • February 28, 2023

I do understand that you necessarily do not want to override all the descriptions and that is why I mentioned in my earlier post “based on the TranType”. 

But of course, you can proceed as you see what best fits you.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • 1204 replies
  • Answer
  • February 28, 2023

I had a look at the Method Override. I believe you need to override

public static bool DepreciateAsset(IEnumerable<FABookBalance> books, DateTime? DateTo, string PeriodTo, bool IsMassProcess, bool IncludeLastPeriod)

in AssetProcess graph if you wish but you need to consider it is the worst type of override you have to do (the change should be made in the middle of the method meaning you have to copy/paste the method code and make the change which is not really an override (typically we make changes at the beginning or end and call the base method accordingly).

My suggestion: Do not do it because 1) you do not need to do it really 2) in each update you have to compare and revise your code according to Acumatica changes that mean high maintenance 3) will take more time and is more complex to develop

Instead, override FATran RowInserting/Inserted Handler for the Depreciation Type transaction as you want which it really where it should do, doesn’t need any maintenance unless Acumatica makes a fundamental change to its platform and can be developed and tested within one hour.

 

But as mentioned it is your choice.


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 85 replies
  • March 9, 2023

Hello @aaghaei,

I have tried both approach and I think your propose is more efficient so I will go with them.

Thank you very much for your support. I’m very appreciate it.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings