Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-1434 General Ledger
  3. OFBIZ-1458

Implement an automatic GL posting service triggered when a physical inventory variance is performed

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Trunk
    • None
    • accounting
    • None

    Description

      The name of the service can be "createAcctgTransForPhysicalInventoryVariance" or similar.
      Input field: physicalInventoryId
      Output field: acctgTransId

      We can use the following template for this service: createAcctgTransForShipmentReceipt in GeneralLedgerServices.xml

      The service is triggered by a SECA rule on createPhysicalInventoryAndVariance
      The service will do the following tasks:
      1) select all the InventoryItemDetails for the given physicalInventoryId
      2) iterate the list of InventoryItemDetails and for each InventoryItemDetail:
      2a) select the associated InventoryItem
      2b) compute the following amount: origAmount = InventoryItemDetail.quantityOnHandDiff * InventoryItem.unitCost
      2c) create one AcctgTransEntry for the credit: debitCreditFlag=C, glAcctgTransTypeId=InventoryItemDetail.reasonId, productId=InventoryItem.productId, origAmount=(the value computed in 2b), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=InventoryItem.ownerPartyId
      2d) create one AcctgTransEntry for the debit: debitCreditFlag=D, glAcctgTransTypeId=INVENTORY_ACCOUNT, productId=InventoryItem.productId, origAmount=(the value computed in 2b), origCurrencyUomId=InventoryItem.currencyUomId, organizationPartyId=InventoryItem.ownerPartyId
      2e) put the two entries in a list (go back to 2a)
      3) when the iteration is done, call the createAcctgTransAndEntries with the following fields: acctgTransTypeId=ITEM_VARIANCE_ACCTG_, acctgTransEntries=(the list at 2e), physicalInventoryId=parameters.physicalInventoryId, glFiscalTypeId=ACTUAL

      the ECA will be:
      <eca service="createPhysicalInventoryAndVariance" event="commit">
      <condition field-name="physicalInventoryId" operator="is-not-empty"/>
      <action service="createAcctgTransForPhysicalInventoryVariance" mode="sync"/>
      </eca>

      You can then test the service when you go into an Inventory Item in the facility, and perform a manual inventory variance.

      Attachments

        Activity

          People

            anilpatel Anil K Patel
            jacopoc Jacopo Cappellato
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: