Expense Products After Material Receipt

The purpose of this page is to help you automate expensing product after receiving it.  Let's say you have scenario where you are buying product for both production AND engineering/quality/test departments. A common question is "how do I change the product asset account of a stocked product at the time of receipt?" It is not a good idea to change the account for the following reasons: Most of the time, you do not need these products in stock. Instead, you can receive them then immediately expense them through a Physical Inventory or Internal User document. If you do this process with any kind of frequency, you will want to consider automating this process. Here are the assumptions: Here are the topics/tasks involved with automating the above scenario:
  1. Add a ChuBoe_Expensed_Qty (qty) and ChuBoe_Expensed_Charge_ID (charge drop down) to the Purchase Order window => Line sub-tab.
  2. Add the same fields to the Material Receipt window => Line sub-tab
  3. Create a plugin. A single plugin will hold all code for this enhancement (step 1 and step 2).
  4. Propagate the above fields from the C_OrderLine table to the M_InOutLine table on M_InOutLine's 'new' event using the Model Event plugin.
  5. Automate the creation and completion of a Physical Inventory document using the M_InOut 'after complete' event using the Model Event plugin.
Note: make sure you set the plugin's start level to 5. This is important because iDempiere has a start level of 4. If your plugin starts before iDempiere, your plugin's initialize method will get ignored and as a result will not get called when the desired events occur.