Re: svn commit: r600738 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml servicedef/secas.xml servicedef/services_ledger.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r600738 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml servicedef/secas.xml servicedef/services_ledger.xml

Adrian Crum
This commit reverses the permissions checking work I just did. I recommend taking another look at it.

-Adrian

[hidden email] wrote:

> Author: apatel
> Date: Mon Dec  3 16:12:27 2007
> New Revision: 600738
>
> URL: http://svn.apache.org/viewvc?rev=600738&view=rev
> Log:
> Implement an automatic GL posting service triggered when a physical inventory variance is performed.
>
> Sachin Chourasia , Thanks for providing implementation. And also our thanks to Vikas Mayur, Ashish Vijaywargiya, Mridul Pathak, Pankaj Savita and others for managing and helping the team implementing these services.
>
> Modified:
>     ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
>     ofbiz/trunk/applications/accounting/servicedef/secas.xml
>     ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
>
> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=600738&r1=600737&r2=600738&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original)
> +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Mon Dec  3 16:12:27 2007
> @@ -653,4 +653,49 @@
>          <field-to-result field-name="acctgTransId" result-name="acctgTransId"/>
>      </simple-method>
>  
> +    <simple-method method-name="createAcctgTransForPhysicalInventoryVariance" short-description="Create an Account Transaction For Physical Inventory Variance">
> +        <!-- retrieve ledger rounding properties -->  
> +        <property-to-field resource="arithmetic" property="ledger.decimals" field-name="ledgerDecimals"/>
> +        <property-to-field resource="arithmetic" property="ledger.rounding" field-name="roundingMode"/>
> +        <entity-and entity-name="InventoryItemDetail" list-name="inventoryItemDetails">
> +            <field-map field-name="physicalInventoryId" env-name="parameters.physicalInventoryId"/>
> +            <order-by field-name="inventoryItemId"/>
> +        </entity-and>
> +        <iterate list-name="inventoryItemDetails" entry-name="inventoryItemDetail">
> +            <get-related-one value-name="inventoryItemDetail" relation-name="InventoryItem" to-value-name="inventoryItem"/>        
> +            <calculate field-name="origAmount" type="BigDecimal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
> +                <calcop operator="multiply">
> +                    <calcop operator="get" field-name="inventoryItemDetail.quantityOnHandDiff"/>
> +                    <calcop operator="get" field-name="inventoryItem.unitCost "/>
> +                </calcop>
> +            </calculate>
> +            <!-- Credit Entries -->
> +            <make-value entity-name="AcctgTransEntry" value-name="creditEntry"/>
> +            <set field="creditEntry.debitCreditFlag" value="C"/>
> +            <set field="creditEntry.glAccountTypeId" from-field="inventoryItemDetail.reasonEnumId"/>
> +            <set field="creditEntry.productId" from-field="inventoryItem.productId"/>
> +            <set field="creditEntry.origAmount" from-field="origAmount"/>
> +            <set field="creditEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/>
> +            <set field="creditEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
> +            <!-- Debit Entries-->
> +            <make-value entity-name="AcctgTransEntry" value-name="debitEntry"/>
> +            <set field="debitEntry.debitCreditFlag" value="D"/>
> +            <set field="debitEntry.glAccountTypeId" value="INVENTORY_ACCOUNT"/>
> +            <set field="debitEntry.productId" from-field="inventoryItem.productId"/>
> +            <set field="debitEntry.origAmount" from-field="origAmount"/>
> +            <set field="debitEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/>
> +            <set field="debitEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
> +            <set field="acctgTransEntries[]" from-field="creditEntry" type="Object"/>
> +            <set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/>            
> +        </iterate>
> +        <set field="createAcctgTransAndEntriesInMap.glFiscalTypeId" value="ACTUAL"/>
> +        <set field="createAcctgTransAndEntriesInMap.acctgTransEntries" from-field="acctgTransEntries"/>
> +        <set field="createAcctgTransAndEntriesInMap.physicalInventoryId" from-field="parameters.physicalInventoryId"/>
> +        <set field="createAcctgTransAndEntriesInMap.acctgTransTypeId" value="ITEM_VARIANCE_ACCTG_"/>
> +        <call-service service-name="createAcctgTransAndEntries" in-map-name="createAcctgTransAndEntriesInMap">
> +            <result-to-field result-name="acctgTransId"/>
> +        </call-service>
> +        <field-to-result field-name="acctgTransId" result-name="acctgTransId"/>
> +   </simple-method>
> +
>  </simple-methods>
>
> Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?rev=600738&r1=600737&r2=600738&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
> +++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Mon Dec  3 16:12:27 2007
> @@ -164,4 +164,11 @@
>          <condition field-name="receiptId" operator="is-empty"/>
>          <action service="createAcctgTransForInventoryItemCostChange" mode="sync"/>
>      </eca>
> +
> +    <!-- attempt to create AcctgTrans Physical Inventory Variance when Physical InventoryAndVariance is created-->
> +    <eca service="createPhysicalInventoryAndVariance" event="commit">
> +        <condition field-name="physicalInventoryId" operator="is-not-empty"/>
> +        <action service="createAcctgTransForPhysicalInventoryVariance" mode="sync"/>
> +    </eca>
> +    
>  </service-eca>
>
> Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=600738&r1=600737&r2=600738&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
> +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Mon Dec  3 16:12:27 2007
> @@ -30,7 +30,6 @@
>      <service name="createGlAccount" default-entity-name="GlAccount" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlAccount" auth="true">
>          <description>Create a GlAccount record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
>          <auto-attributes include="pk" mode="INOUT" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true"/>
>          <override name="glAccountTypeId" optional="false"/>
> @@ -41,40 +40,35 @@
>      <service name="updateGlAccount" default-entity-name="GlAccount" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlAccount" auth="true">
>          <description>Update a GlAccount record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true"/>
>      </service>
>      <service name="deleteGlAccount" default-entity-name="GlAccount" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlAccount" auth="true">
>          <description>Delete a GlAccount record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
>  
>      <service name="createGlAccountOrganization" default-entity-name="GlAccountOrganization" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlAccountOrganization" auth="true">
>          <description>Create a GlAccount record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true"/>
>      </service>
>      <service name="updateGlAccountOrganization" default-entity-name="GlAccountOrganization" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlAccountOrganization" auth="true">
>          <description>Update a GlAccount record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true"/>
>      </service>
>      <service name="deleteGlAccountOrganization" default-entity-name="GlAccountOrganization" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlAccountOrganization" auth="true">
>          <description>Delete a GlAccount record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
>  
>      <!-- GlJournal -->
> -    <service name="quickCreateAcctgTransAndEntries" engine="simple"
> +    <service name="quickCreateAcctgTransAndEntries" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="quickCreateAcctgTransAndEntries" auth="true">
>          <description>Creates an AcctgTrans and two offsetting AcctgTransEntry records</description>
>          <auto-attributes mode="IN" entity-name="AcctgTrans" include="nonpk" optional="true"/>
> @@ -87,11 +81,10 @@
>          <attribute name="acctgTransId" type="String" mode="OUT" optional="false"/>
>          <override name="amount" optional="false"/>
>      </service>
> -    
> +
>      <service name="calculateGlJournalTrialBalance" default-entity-name="GlJournal" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="calculateGlJournalTrialBalance" auth="true">
>          <description>Calculate Trial Balance for a GlJournal</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="VIEW"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <attribute name="debitTotal" type="Double" mode="OUT" optional="false"/>
>          <attribute name="creditTotal" type="Double" mode="OUT" optional="false"/>
> @@ -105,7 +98,6 @@
>      <service name="createGlJournal" default-entity-name="GlJournal" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlJournal" auth="true">
>          <description>Create a GlJournal record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
>          <auto-attributes include="pk" mode="OUT" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true">
>              <exclude field-name="isPosted"/>
> @@ -116,7 +108,6 @@
>      <service name="updateGlJournal" default-entity-name="GlJournal" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlJournal" auth="true">
>          <description>Update a GlJournal record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true">
>              <exclude field-name="isPosted"/>
> @@ -126,7 +117,6 @@
>      <service name="deleteGlJournal" default-entity-name="GlJournal" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlJournal" auth="true">
>          <description>Delete a GlJournal record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
>  
> @@ -134,7 +124,6 @@
>      <service name="createGlReconciliation" default-entity-name="GlReconciliation" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlReconciliation" auth="true">
>          <description>Create a GlReconciliation record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
>          <auto-attributes include="pk" mode="OUT" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true">
>              <exclude field-name="createdByUserLogin"/>
> @@ -145,7 +134,6 @@
>      <service name="updateGlReconciliation" default-entity-name="GlReconciliation" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlReconciliation" auth="true">
>          <description>Update a GlReconciliation record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true">
>              <exclude field-name="createdByUserLogin"/>
> @@ -155,28 +143,24 @@
>      <service name="deleteGlReconciliation" default-entity-name="GlReconciliation" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlReconciliation" auth="true">
>          <description>Delete a GlReconciliation record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
>  
>      <service name="createGlReconciliationEntry" default-entity-name="GlReconciliationEntry" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlReconciliationEntry" auth="true">
>          <description>Add an Entry to a GlReconciliation</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="false"/>
>      </service>
>      <service name="updateGlReconciliationEntry" default-entity-name="GlReconciliationEntry" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlReconciliationEntry" auth="true">
>          <description>Update an Entry to a GlReconciliation record</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="false"/>
>      </service>
>      <service name="deleteGlReconciliationEntry" default-entity-name="GlReconciliationEntry" engine="simple"
>              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlReconciliationEntry" auth="true">
>          <description>Remove an Entry from a GlReconciliation</description>
> -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
>  
> @@ -195,21 +179,27 @@
>      <service name="createAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="createAcctgTrans" auth="true">
>          <description>Create a AcctgTrans record.  isPosted is forced to "N"</description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_CREATE"/>
> +        </required-permissions>
>          <implements service="interfaceAcctgTrans"/>
>          <auto-attributes include="pk" mode="OUT" optional="false"/>
>      </service>
>      <service name="updateAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="updateAcctgTrans" auth="true">
>          <description>Update a AcctgTrans record</description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="UPDATE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_UPDATE"/>
> +        </required-permissions>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true"/>
>      </service>
>      <service name="deleteAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="deleteAcctgTrans" auth="true">
>          <description>Delete a AcctgTrans record</description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="DELETE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_DELETE"/>
> +        </required-permissions>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
>  
> @@ -227,7 +217,9 @@
>      <service name="createAcctgTransEntry" default-entity-name="AcctgTransEntry" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="createAcctgTransEntry" auth="true">
>          <description>Add an Entry to a AcctgTrans.  Will use baseCurrencyUomId in PartyAcctgPreference if no currencyUomId is in parameters.</description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_CREATE"/>
> +        </required-permissions>
>          <implements service="interfaceAcctgTransEntry"/>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <override name="acctgTransEntrySeqId" mode="OUT"/>
> @@ -235,14 +227,18 @@
>      <service name="updateAcctgTransEntry" default-entity-name="AcctgTransEntry" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="updateAcctgTransEntry" auth="true">
>          <description>Update an Entry to a AcctgTrans record</description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="UPDATE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_UPDATE"/>
> +        </required-permissions>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true"/>
>      </service>
>      <service name="deleteAcctgTransEntry" default-entity-name="AcctgTransEntry" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="deleteAcctgTransEntry" auth="true">
>          <description>Remove an Entry from a AcctgTrans</description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="DELETE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_DELETE"/>
> +        </required-permissions>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
>  
> @@ -255,11 +251,14 @@
>              check that the debits and credits balance out.  The idea is that unbalanced transactions can be created here, but they will need
>              to be created before they are actually posted, and a later posting service will actually check that the transaction is balanced.
>          </description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_CREATE"/>
> +        </required-permissions>
>          <auto-attributes include="pk" mode="IN" optional="true"/>
>          <auto-attributes include="nonpk" mode="IN" optional="true"/>
>          <attribute name="acctgTransEntries" type="java.util.List" mode="IN" optional="false"/>
>          <attribute name="acctgTransId" type="String" mode="OUT"/>
> +        <!-- TODO: make required-permissions tag work here rather than inside the simple XML -->
>      </service>
>      <service name="calculateAcctgTransTrialBalance" default-entity-name="AcctgTrans" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="calculateAcctgTransTrialBalance" auth="true">
> @@ -272,30 +271,32 @@
>      <service name="postAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
>              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="postAcctgTrans" auth="true"
>              transaction-timeout="600">
> -        <description>Post a AcctgTrans and related entries.  This will make sure that the time period is not closed and that
> -         the sum of the debits and credits are equal.
> +        <description>Post a AcctgTrans and related entries.  This will make sure that the time period is not closed and that
> +         the sum of the debits and credits are equal.
>          </description>
> -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> +        <required-permissions join-type="OR">
> +            <check-permission permission="ACCOUNTING" action="_ATX_POST"/>
> +        </required-permissions>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>          <attribute name="verifyOnly" type="String" mode="IN" optional="true"/>
>      </service>
>  
>      <!-- Miscellaneous Ledger-related services -->
> -    <service name="getGlAccountFromAccountType" engine="simple"
> -            location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getGlAccountFromAccountType" auth="true">
> -        <description>Look up a GlAccountId first in ProductGlAccount by productId and productGlAccountTypeId, if not found,
> -            then in organizationPartyId and glAccountTypeId </description>
> +    <service name="getGlAccountFromAccountType" engine="simple"
> +            location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getGlAccountFromAccountType" auth="true">
> +        <description>Look up a GlAccountId first in ProductGlAccount by productId and productGlAccountTypeId, if not found,
> +            then in organizationPartyId and glAccountTypeId </description>
>          <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
>          <attribute name="glAccountTypeId" type="String" mode="IN" optional="false"/>
>          <attribute name="productId" type="String" mode="IN" optional="true"/>
>          <attribute name="varianceReasonId" type="String" mode="IN" optional="true"/>
>          <attribute name="glAccountId" type="String" mode="OUT" optional="true"/>
>      </service>
> -    <service name="getInventoryItemOwner" default-entity-name="InventoryItem" engine="simple"
> -        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getInventoryItemOwner" auth="true">
> -        <description>get an ownerPartyId from inventoryItemId </description>
> -        <auto-attributes include="pk" mode="IN" optional="false"/>
> -        <attribute name="ownerPartyId" type="String" mode="OUT" optional="false"/>
> +    <service name="getInventoryItemOwner" default-entity-name="InventoryItem" engine="simple"
> +        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getInventoryItemOwner" auth="true">
> +        <description>get an ownerPartyId from inventoryItemId </description>
> +        <auto-attributes include="pk" mode="IN" optional="false"/>
> +        <attribute name="ownerPartyId" type="String" mode="OUT" optional="false"/>
>      </service>
>  
>      <!-- Services for the automatic creation of accounting transactions based on business transactions
> @@ -306,13 +307,6 @@
>          <attribute name="itemIssuanceId" type="String" mode="IN" optional="false"/>
>          <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>      </service>
> -    <service name="createAcctgTransForInventoryItemCostChange" engine="simple" auth="true"
> -        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForInventoryItemCostChange">
> -        <description>Create accounting transaction when item cost is changed (D: INV_ADJ_VAL, C: INVENTORY_ACCOUNT)</description>
> -        <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/>
> -        <attribute name="inventoryItemDetailSeqId" type="String" mode="IN" optional="false"/>
> -        <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
> -    </service>
>      <!-- DEPRECATED: use createAcctgTransForSalesShipmentIssuance instead -->
>      <service name="createAcctgTransForSalesShipment" engine="simple"  auth="true"
>          location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesShipment">
> @@ -345,7 +339,7 @@
>          <description>Delete a FinAccountTypeGlAccount</description>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
> -    
> +
>      <!-- VarianceReasonGlAccount Services -->
>      <service name="createVarianceReasonGlAccount" default-entity-name="VarianceReasonGlAccount" engine="simple"
>                  location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="createVarianceReasonGlAccount" auth="true">
> @@ -364,7 +358,7 @@
>          <description>delete a Variance Reason Gl Account</description>
>          <auto-attributes include="pk" mode="IN" optional="false"/>
>      </service>
> -    
> +
>      <!-- Permission services -->
>      <service name="basicGeneralLedgerPermissionCheck" engine="simple"
>              location="component://accounting/script/org/ofbiz/accounting/permissions/PermissionServices.xml" invoke="basePermissionCheck">
> @@ -375,6 +369,14 @@
>              location="component://accounting/script/org/ofbiz/accounting/permissions/PermissionServices.xml" invoke="acctgTransactionPermissionCheck">
>          <description>Basic General Ledger Permission Checking Logic</description>
>          <implements service="permissionInterface"/>
> +    </service>
> +
> +    <!-- Service for the automatic creation of AcctgTransForPhysicalInventoryVariance, triggered by SECAs -->
> +    <service name="createAcctgTransForPhysicalInventoryVariance" engine="simple"
> +                location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForPhysicalInventoryVariance">
> +        <description>Create an AcctgEntry for Physical Inventory variance</description>
> +        <attribute name="physicalInventoryId" type="String" mode="IN" optional="false"/>
> +        <attribute name="acctgTransId" type="String" mode="OUT" optional="false"/>
>      </service>
>  
>  </services>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r600738 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml servicedef/secas.xml servicedef/services_ledger.xml

Anil Patel-3
Sorry, Adrian thanks. I tried, but seems, I missed in this case. I'll
fix it.

Regards
Anil
On Mon, 2007-12-03 at 16:16 -0800, Adrian Crum wrote:

> This commit reverses the permissions checking work I just did. I recommend taking another look at it.
>
> -Adrian
>
> [hidden email] wrote:
> > Author: apatel
> > Date: Mon Dec  3 16:12:27 2007
> > New Revision: 600738
> >
> > URL: http://svn.apache.org/viewvc?rev=600738&view=rev
> > Log:
> > Implement an automatic GL posting service triggered when a physical inventory variance is performed.
> >
> > Sachin Chourasia , Thanks for providing implementation. And also our thanks to Vikas Mayur, Ashish Vijaywargiya, Mridul Pathak, Pankaj Savita and others for managing and helping the team implementing these services.
> >
> > Modified:
> >     ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
> >     ofbiz/trunk/applications/accounting/servicedef/secas.xml
> >     ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
> >
> > Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=600738&r1=600737&r2=600738&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original)
> > +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Mon Dec  3 16:12:27 2007
> > @@ -653,4 +653,49 @@
> >          <field-to-result field-name="acctgTransId" result-name="acctgTransId"/>
> >      </simple-method>
> >  
> > +    <simple-method method-name="createAcctgTransForPhysicalInventoryVariance" short-description="Create an Account Transaction For Physical Inventory Variance">
> > +        <!-- retrieve ledger rounding properties -->  
> > +        <property-to-field resource="arithmetic" property="ledger.decimals" field-name="ledgerDecimals"/>
> > +        <property-to-field resource="arithmetic" property="ledger.rounding" field-name="roundingMode"/>
> > +        <entity-and entity-name="InventoryItemDetail" list-name="inventoryItemDetails">
> > +            <field-map field-name="physicalInventoryId" env-name="parameters.physicalInventoryId"/>
> > +            <order-by field-name="inventoryItemId"/>
> > +        </entity-and>
> > +        <iterate list-name="inventoryItemDetails" entry-name="inventoryItemDetail">
> > +            <get-related-one value-name="inventoryItemDetail" relation-name="InventoryItem" to-value-name="inventoryItem"/>        
> > +            <calculate field-name="origAmount" type="BigDecimal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
> > +                <calcop operator="multiply">
> > +                    <calcop operator="get" field-name="inventoryItemDetail.quantityOnHandDiff"/>
> > +                    <calcop operator="get" field-name="inventoryItem.unitCost "/>
> > +                </calcop>
> > +            </calculate>
> > +            <!-- Credit Entries -->
> > +            <make-value entity-name="AcctgTransEntry" value-name="creditEntry"/>
> > +            <set field="creditEntry.debitCreditFlag" value="C"/>
> > +            <set field="creditEntry.glAccountTypeId" from-field="inventoryItemDetail.reasonEnumId"/>
> > +            <set field="creditEntry.productId" from-field="inventoryItem.productId"/>
> > +            <set field="creditEntry.origAmount" from-field="origAmount"/>
> > +            <set field="creditEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/>
> > +            <set field="creditEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
> > +            <!-- Debit Entries-->
> > +            <make-value entity-name="AcctgTransEntry" value-name="debitEntry"/>
> > +            <set field="debitEntry.debitCreditFlag" value="D"/>
> > +            <set field="debitEntry.glAccountTypeId" value="INVENTORY_ACCOUNT"/>
> > +            <set field="debitEntry.productId" from-field="inventoryItem.productId"/>
> > +            <set field="debitEntry.origAmount" from-field="origAmount"/>
> > +            <set field="debitEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/>
> > +            <set field="debitEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
> > +            <set field="acctgTransEntries[]" from-field="creditEntry" type="Object"/>
> > +            <set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/>            
> > +        </iterate>
> > +        <set field="createAcctgTransAndEntriesInMap.glFiscalTypeId" value="ACTUAL"/>
> > +        <set field="createAcctgTransAndEntriesInMap.acctgTransEntries" from-field="acctgTransEntries"/>
> > +        <set field="createAcctgTransAndEntriesInMap.physicalInventoryId" from-field="parameters.physicalInventoryId"/>
> > +        <set field="createAcctgTransAndEntriesInMap.acctgTransTypeId" value="ITEM_VARIANCE_ACCTG_"/>
> > +        <call-service service-name="createAcctgTransAndEntries" in-map-name="createAcctgTransAndEntriesInMap">
> > +            <result-to-field result-name="acctgTransId"/>
> > +        </call-service>
> > +        <field-to-result field-name="acctgTransId" result-name="acctgTransId"/>
> > +   </simple-method>
> > +
> >  </simple-methods>
> >
> > Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?rev=600738&r1=600737&r2=600738&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
> > +++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Mon Dec  3 16:12:27 2007
> > @@ -164,4 +164,11 @@
> >          <condition field-name="receiptId" operator="is-empty"/>
> >          <action service="createAcctgTransForInventoryItemCostChange" mode="sync"/>
> >      </eca>
> > +
> > +    <!-- attempt to create AcctgTrans Physical Inventory Variance when Physical InventoryAndVariance is created-->
> > +    <eca service="createPhysicalInventoryAndVariance" event="commit">
> > +        <condition field-name="physicalInventoryId" operator="is-not-empty"/>
> > +        <action service="createAcctgTransForPhysicalInventoryVariance" mode="sync"/>
> > +    </eca>
> > +    
> >  </service-eca>
> >
> > Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=600738&r1=600737&r2=600738&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
> > +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Mon Dec  3 16:12:27 2007
> > @@ -30,7 +30,6 @@
> >      <service name="createGlAccount" default-entity-name="GlAccount" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlAccount" auth="true">
> >          <description>Create a GlAccount record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
> >          <auto-attributes include="pk" mode="INOUT" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >          <override name="glAccountTypeId" optional="false"/>
> > @@ -41,40 +40,35 @@
> >      <service name="updateGlAccount" default-entity-name="GlAccount" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlAccount" auth="true">
> >          <description>Update a GlAccount record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >      </service>
> >      <service name="deleteGlAccount" default-entity-name="GlAccount" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlAccount" auth="true">
> >          <description>Delete a GlAccount record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> >  
> >      <service name="createGlAccountOrganization" default-entity-name="GlAccountOrganization" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlAccountOrganization" auth="true">
> >          <description>Create a GlAccount record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >      </service>
> >      <service name="updateGlAccountOrganization" default-entity-name="GlAccountOrganization" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlAccountOrganization" auth="true">
> >          <description>Update a GlAccount record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >      </service>
> >      <service name="deleteGlAccountOrganization" default-entity-name="GlAccountOrganization" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlAccountOrganization" auth="true">
> >          <description>Delete a GlAccount record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> >  
> >      <!-- GlJournal -->
> > -    <service name="quickCreateAcctgTransAndEntries" engine="simple"
> > +    <service name="quickCreateAcctgTransAndEntries" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="quickCreateAcctgTransAndEntries" auth="true">
> >          <description>Creates an AcctgTrans and two offsetting AcctgTransEntry records</description>
> >          <auto-attributes mode="IN" entity-name="AcctgTrans" include="nonpk" optional="true"/>
> > @@ -87,11 +81,10 @@
> >          <attribute name="acctgTransId" type="String" mode="OUT" optional="false"/>
> >          <override name="amount" optional="false"/>
> >      </service>
> > -    
> > +
> >      <service name="calculateGlJournalTrialBalance" default-entity-name="GlJournal" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="calculateGlJournalTrialBalance" auth="true">
> >          <description>Calculate Trial Balance for a GlJournal</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="VIEW"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <attribute name="debitTotal" type="Double" mode="OUT" optional="false"/>
> >          <attribute name="creditTotal" type="Double" mode="OUT" optional="false"/>
> > @@ -105,7 +98,6 @@
> >      <service name="createGlJournal" default-entity-name="GlJournal" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlJournal" auth="true">
> >          <description>Create a GlJournal record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
> >          <auto-attributes include="pk" mode="OUT" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true">
> >              <exclude field-name="isPosted"/>
> > @@ -116,7 +108,6 @@
> >      <service name="updateGlJournal" default-entity-name="GlJournal" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlJournal" auth="true">
> >          <description>Update a GlJournal record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true">
> >              <exclude field-name="isPosted"/>
> > @@ -126,7 +117,6 @@
> >      <service name="deleteGlJournal" default-entity-name="GlJournal" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlJournal" auth="true">
> >          <description>Delete a GlJournal record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> >  
> > @@ -134,7 +124,6 @@
> >      <service name="createGlReconciliation" default-entity-name="GlReconciliation" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlReconciliation" auth="true">
> >          <description>Create a GlReconciliation record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
> >          <auto-attributes include="pk" mode="OUT" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true">
> >              <exclude field-name="createdByUserLogin"/>
> > @@ -145,7 +134,6 @@
> >      <service name="updateGlReconciliation" default-entity-name="GlReconciliation" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlReconciliation" auth="true">
> >          <description>Update a GlReconciliation record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true">
> >              <exclude field-name="createdByUserLogin"/>
> > @@ -155,28 +143,24 @@
> >      <service name="deleteGlReconciliation" default-entity-name="GlReconciliation" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlReconciliation" auth="true">
> >          <description>Delete a GlReconciliation record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> >  
> >      <service name="createGlReconciliationEntry" default-entity-name="GlReconciliationEntry" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlReconciliationEntry" auth="true">
> >          <description>Add an Entry to a GlReconciliation</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="CREATE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="false"/>
> >      </service>
> >      <service name="updateGlReconciliationEntry" default-entity-name="GlReconciliationEntry" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlReconciliationEntry" auth="true">
> >          <description>Update an Entry to a GlReconciliation record</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="UPDATE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="false"/>
> >      </service>
> >      <service name="deleteGlReconciliationEntry" default-entity-name="GlReconciliationEntry" engine="simple"
> >              location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="deleteGlReconciliationEntry" auth="true">
> >          <description>Remove an Entry from a GlReconciliation</description>
> > -        <permission-service service-name="basicGeneralLedgerPermissionCheck" main-action="DELETE"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> >  
> > @@ -195,21 +179,27 @@
> >      <service name="createAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="createAcctgTrans" auth="true">
> >          <description>Create a AcctgTrans record.  isPosted is forced to "N"</description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_CREATE"/>
> > +        </required-permissions>
> >          <implements service="interfaceAcctgTrans"/>
> >          <auto-attributes include="pk" mode="OUT" optional="false"/>
> >      </service>
> >      <service name="updateAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="updateAcctgTrans" auth="true">
> >          <description>Update a AcctgTrans record</description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="UPDATE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_UPDATE"/>
> > +        </required-permissions>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >      </service>
> >      <service name="deleteAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="deleteAcctgTrans" auth="true">
> >          <description>Delete a AcctgTrans record</description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="DELETE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_DELETE"/>
> > +        </required-permissions>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> >  
> > @@ -227,7 +217,9 @@
> >      <service name="createAcctgTransEntry" default-entity-name="AcctgTransEntry" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="createAcctgTransEntry" auth="true">
> >          <description>Add an Entry to a AcctgTrans.  Will use baseCurrencyUomId in PartyAcctgPreference if no currencyUomId is in parameters.</description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_CREATE"/>
> > +        </required-permissions>
> >          <implements service="interfaceAcctgTransEntry"/>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <override name="acctgTransEntrySeqId" mode="OUT"/>
> > @@ -235,14 +227,18 @@
> >      <service name="updateAcctgTransEntry" default-entity-name="AcctgTransEntry" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="updateAcctgTransEntry" auth="true">
> >          <description>Update an Entry to a AcctgTrans record</description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="UPDATE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_UPDATE"/>
> > +        </required-permissions>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >      </service>
> >      <service name="deleteAcctgTransEntry" default-entity-name="AcctgTransEntry" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="deleteAcctgTransEntry" auth="true">
> >          <description>Remove an Entry from a AcctgTrans</description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="DELETE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_DELETE"/>
> > +        </required-permissions>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> >  
> > @@ -255,11 +251,14 @@
> >              check that the debits and credits balance out.  The idea is that unbalanced transactions can be created here, but they will need
> >              to be created before they are actually posted, and a later posting service will actually check that the transaction is balanced.
> >          </description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_CREATE"/>
> > +        </required-permissions>
> >          <auto-attributes include="pk" mode="IN" optional="true"/>
> >          <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >          <attribute name="acctgTransEntries" type="java.util.List" mode="IN" optional="false"/>
> >          <attribute name="acctgTransId" type="String" mode="OUT"/>
> > +        <!-- TODO: make required-permissions tag work here rather than inside the simple XML -->
> >      </service>
> >      <service name="calculateAcctgTransTrialBalance" default-entity-name="AcctgTrans" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="calculateAcctgTransTrialBalance" auth="true">
> > @@ -272,30 +271,32 @@
> >      <service name="postAcctgTrans" default-entity-name="AcctgTrans" engine="simple"
> >              location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="postAcctgTrans" auth="true"
> >              transaction-timeout="600">
> > -        <description>Post a AcctgTrans and related entries.  This will make sure that the time period is not closed and that
> > -         the sum of the debits and credits are equal.
> > +        <description>Post a AcctgTrans and related entries.  This will make sure that the time period is not closed and that
> > +         the sum of the debits and credits are equal.
> >          </description>
> > -        <permission-service service-name="acctgTransactionPermissionCheck" main-action="CREATE"/>
> > +        <required-permissions join-type="OR">
> > +            <check-permission permission="ACCOUNTING" action="_ATX_POST"/>
> > +        </required-permissions>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >          <attribute name="verifyOnly" type="String" mode="IN" optional="true"/>
> >      </service>
> >  
> >      <!-- Miscellaneous Ledger-related services -->
> > -    <service name="getGlAccountFromAccountType" engine="simple"
> > -            location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getGlAccountFromAccountType" auth="true">
> > -        <description>Look up a GlAccountId first in ProductGlAccount by productId and productGlAccountTypeId, if not found,
> > -            then in organizationPartyId and glAccountTypeId </description>
> > +    <service name="getGlAccountFromAccountType" engine="simple"
> > +            location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getGlAccountFromAccountType" auth="true">
> > +        <description>Look up a GlAccountId first in ProductGlAccount by productId and productGlAccountTypeId, if not found,
> > +            then in organizationPartyId and glAccountTypeId </description>
> >          <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
> >          <attribute name="glAccountTypeId" type="String" mode="IN" optional="false"/>
> >          <attribute name="productId" type="String" mode="IN" optional="true"/>
> >          <attribute name="varianceReasonId" type="String" mode="IN" optional="true"/>
> >          <attribute name="glAccountId" type="String" mode="OUT" optional="true"/>
> >      </service>
> > -    <service name="getInventoryItemOwner" default-entity-name="InventoryItem" engine="simple"
> > -        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getInventoryItemOwner" auth="true">
> > -        <description>get an ownerPartyId from inventoryItemId </description>
> > -        <auto-attributes include="pk" mode="IN" optional="false"/>
> > -        <attribute name="ownerPartyId" type="String" mode="OUT" optional="false"/>
> > +    <service name="getInventoryItemOwner" default-entity-name="InventoryItem" engine="simple"
> > +        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getInventoryItemOwner" auth="true">
> > +        <description>get an ownerPartyId from inventoryItemId </description>
> > +        <auto-attributes include="pk" mode="IN" optional="false"/>
> > +        <attribute name="ownerPartyId" type="String" mode="OUT" optional="false"/>
> >      </service>
> >  
> >      <!-- Services for the automatic creation of accounting transactions based on business transactions
> > @@ -306,13 +307,6 @@
> >          <attribute name="itemIssuanceId" type="String" mode="IN" optional="false"/>
> >          <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
> >      </service>
> > -    <service name="createAcctgTransForInventoryItemCostChange" engine="simple" auth="true"
> > -        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForInventoryItemCostChange">
> > -        <description>Create accounting transaction when item cost is changed (D: INV_ADJ_VAL, C: INVENTORY_ACCOUNT)</description>
> > -        <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/>
> > -        <attribute name="inventoryItemDetailSeqId" type="String" mode="IN" optional="false"/>
> > -        <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
> > -    </service>
> >      <!-- DEPRECATED: use createAcctgTransForSalesShipmentIssuance instead -->
> >      <service name="createAcctgTransForSalesShipment" engine="simple"  auth="true"
> >          location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesShipment">
> > @@ -345,7 +339,7 @@
> >          <description>Delete a FinAccountTypeGlAccount</description>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> > -    
> > +
> >      <!-- VarianceReasonGlAccount Services -->
> >      <service name="createVarianceReasonGlAccount" default-entity-name="VarianceReasonGlAccount" engine="simple"
> >                  location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="createVarianceReasonGlAccount" auth="true">
> > @@ -364,7 +358,7 @@
> >          <description>delete a Variance Reason Gl Account</description>
> >          <auto-attributes include="pk" mode="IN" optional="false"/>
> >      </service>
> > -    
> > +
> >      <!-- Permission services -->
> >      <service name="basicGeneralLedgerPermissionCheck" engine="simple"
> >              location="component://accounting/script/org/ofbiz/accounting/permissions/PermissionServices.xml" invoke="basePermissionCheck">
> > @@ -375,6 +369,14 @@
> >              location="component://accounting/script/org/ofbiz/accounting/permissions/PermissionServices.xml" invoke="acctgTransactionPermissionCheck">
> >          <description>Basic General Ledger Permission Checking Logic</description>
> >          <implements service="permissionInterface"/>
> > +    </service>
> > +
> > +    <!-- Service for the automatic creation of AcctgTransForPhysicalInventoryVariance, triggered by SECAs -->
> > +    <service name="createAcctgTransForPhysicalInventoryVariance" engine="simple"
> > +                location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForPhysicalInventoryVariance">
> > +        <description>Create an AcctgEntry for Physical Inventory variance</description>
> > +        <attribute name="physicalInventoryId" type="String" mode="IN" optional="false"/>
> > +        <attribute name="acctgTransId" type="String" mode="OUT" optional="false"/>
> >      </service>
> >  
> >  </services>
> >
> >
> >
>