Solved

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

  • 27 February 2023
  • 7 replies
  • 69 views

Userlevel 3
Badge

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.

icon

Best answer by aaghaei 28 February 2023, 05:37

View original

7 replies

Userlevel 7
Badge +5

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

Userlevel 7
Badge +8

@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.

Userlevel 3
Badge

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

 

Userlevel 3
Badge

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

Userlevel 7
Badge +8

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.

Userlevel 7
Badge +8

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.

Userlevel 3
Badge

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.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved