Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Trunk
-
None
-
None
Description
The name of the service can be "createAcctgTransForInventoryItemOwnerChange" or similar.
Input field: inventoryItemId, oldOwnerPartyId
Output field: acctgTransId
We can use the following template for this service: createAcctgTransForShipmentReceipt in GeneralLedgerServices.xml
The service will do the following tasks:
1) compute the origAmount as: origAmount = inventoryItem.quantityOnHandTotal * inventoryItem.unitCost
2) prepare 2 AcctgTransEntry (a debit and a credit) for the oldOwnerPartyId:
CREDIT: debitCreditFlag=C, glAcctgTransTypeId=INVENTORY_XFER_IN, productId=InventoryItem.productId, origAmount=(the value computed in 1), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=oldOwnerPartyId
DEBIT: debitCreditFlag=D, glAcctgTransTypeId=INVENTORY_ACCOUNT, productId=InventoryItem.productId, origAmount=(the value computed in 1), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=oldOwnerPartyId
3) prepare 2 AcctgTransEntry (a debit and a credit) for the inventoryItem.ownerPartyId:
CREDIT: debitCreditFlag=C, glAcctgTransTypeId=INVENTORY_ACCOUNT, productId=InventoryItem.productId, origAmount=(the value computed in 1), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=inventoryItem.ownerPartyId
DEBIT: debitCreditFlag=D, glAcctgTransTypeId=INVENTORY_XFER_OUT, productId=InventoryItem.productId, origAmount=(the value computed in 1), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=inventoryItem.ownerPartyId
4) put the 4 entries in a list and call the createAcctgTransAndEntries service with the following fields: acctgTransTypeId=INVENTORY, acctgTransEntries=(the list with the 4 entries), inventoryItemId=parameters.inventoryItemId, glFiscalTypeId=ACTUAL
The ECA will be:
<eca service="updateInventoryItem" event="commit">
<condition field-name="ownerPartyId" operator="is-not-empty"/>
<condition-field field-name="ownerPartyId" operator="not-equals" to-field-name="oldOwnerPartyId"/>
<action service="createAcctgTransForInventoryItemOwnerChange" mode="sync"/>
</eca>
You can then test the service when you go into an Inventory Item in the facility, and change the ownerPartyId of an inventory item.